Skip to content

Commit d66a99b

Browse files
committed
Merge pull request #363 from glynnc/master
Remove some unnecessary floating-point calculations
2 parents e1d4fce + d3b8644 commit d66a99b

File tree

7 files changed

+15
-766
lines changed

7 files changed

+15
-766
lines changed

src/bitmap.cpp

+3-10
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ bool Bitmap::GetTransparent() const {
129129
}
130130

131131
Color Bitmap::GetTransparentColor() const {
132-
return GetColor(colorkey());
132+
return Color();
133133
}
134134

135135
void Bitmap::SetTransparentColor(Color /* color */) {
@@ -269,14 +269,11 @@ void Bitmap::HSLBlit(int x, int y, Bitmap const& src, Rect const& src_rect_, dou
269269

270270
BitmapUtils* Bitmap::Begin() {
271271
BitmapUtils* bm_utils = BitmapUtils::Create(format, format, false);
272-
bm_utils->SetDstColorKey(colorkey());
273272
return bm_utils;
274273
}
275274

276275
BitmapUtils* Bitmap::Begin(Bitmap const& src) const {
277276
BitmapUtils* bm_utils = BitmapUtils::Create(format, src.format, true);
278-
bm_utils->SetDstColorKey(colorkey());
279-
bm_utils->SetSrcColorKey(src.colorkey());
280277
return bm_utils;
281278
}
282279

@@ -694,10 +691,6 @@ uint32_t Bitmap::amask() const {
694691
return pixel_format.a.mask;
695692
}
696693

697-
uint32_t Bitmap::colorkey() const {
698-
return 0;
699-
}
700-
701694
BitmapRef Bitmap::Resample(int scale_w, int scale_h, const Rect& src_rect) const {
702695
BitmapRef dst(new Bitmap(scale_w, scale_h, GetTransparent()));
703696

@@ -713,7 +706,7 @@ BitmapRef Bitmap::Resample(int scale_w, int scale_h, const Rect& src_rect) const
713706

714707
pixman_image_composite32(PIXMAN_OP_SRC,
715708
bitmap, (pixman_image_t*) NULL, dst->bitmap,
716-
src_rect.x / zoom_x, src_rect.y / zoom_y,
709+
src_rect.x * scale_w / src_rect.width, src_rect.y *scale_h / src_rect.height,
717710
0, 0,
718711
0, 0,
719712
scale_w, scale_h);
@@ -833,7 +826,7 @@ void Bitmap::StretchBlit(Rect const& dst_rect, Bitmap const& src, Rect const& sr
833826

834827
pixman_image_composite32(PIXMAN_OP_OVER,
835828
src.bitmap, mask, bitmap,
836-
src_rect.x / zoom_x, src_rect.y / zoom_y,
829+
src_rect.x * dst_rect.width / src_rect.width, src_rect.y * dst_rect.height / src_rect.height,
837830
0, 0,
838831
dst_rect.x, dst_rect.y,
839832
dst_rect.width, dst_rect.height);

src/bitmap.h

-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ class Bitmap {
182182
uint32_t gmask() const;
183183
uint32_t bmask() const;
184184
uint32_t amask() const;
185-
uint32_t colorkey() const;
186185
uint8_t const* pointer(int x, int y) const;
187186
uint8_t* pointer(int x, int y);
188187

0 commit comments

Comments
 (0)