make xfermode* portable

TBR=reed@google.com

Review URL: https://codereview.chromium.org/1243103002
This commit is contained in:
caryclark 2015-07-21 07:42:45 -07:00 committed by Commit bot
parent 9b8d3580c2
commit 4ec1ac6a2d
4 changed files with 21 additions and 19 deletions

View File

@ -35,7 +35,7 @@ protected:
canvas.clear(0x00000000);
SkPaint paint;
paint.setAntiAlias(true);
sk_tool_utils::set_portable_typeface(&paint);
sk_tool_utils::set_portable_typeface_always(&paint);
paint.setColor(0xD000D000);
paint.setTextSize(SkIntToScalar(96));
const char* str = "e";
@ -70,7 +70,9 @@ protected:
fCheckerboard.allocN32Pixels(80, 80);
SkCanvas checkerboardCanvas(fCheckerboard);
sk_tool_utils::draw_checkerboard(&checkerboardCanvas, 0xFFA0A0A0, 0xFF404040, 8);
sk_tool_utils::draw_checkerboard(&checkerboardCanvas,
sk_tool_utils::color_to_565(0xFFA0A0A0),
sk_tool_utils::color_to_565(0xFF404040), 8);
}
void onDraw(SkCanvas* canvas) override {

View File

@ -26,7 +26,7 @@ static void make_bitmaps(int w, int h, SkBitmap* src, SkBitmap* dst,
{
SkCanvas c(*src);
p.setColor(0xFFFFCC44);
p.setColor(sk_tool_utils::color_to_565(0xFFFFCC44));
r.set(0, 0, ww*3/4, hh*3/4);
c.drawOval(r, p);
}
@ -36,7 +36,7 @@ static void make_bitmaps(int w, int h, SkBitmap* src, SkBitmap* dst,
{
SkCanvas c(*dst);
p.setColor(0xFF66AAFF);
p.setColor(sk_tool_utils::color_to_565(0xFF66AAFF));
r.set(ww/3, hh/3, ww*19/20, hh*19/20);
c.drawRect(r, p);
}
@ -106,11 +106,11 @@ class XfermodesGM : public GM {
case kQuarterClear_SrcType: {
SkScalar halfW = SkIntToScalar(W) / 2;
SkScalar halfH = SkIntToScalar(H) / 2;
p.setColor(0xFF66AAFF);
p.setColor(sk_tool_utils::color_to_565(0xFF66AAFF));
SkRect r = SkRect::MakeXYWH(x + halfW, y, halfW,
SkIntToScalar(H));
canvas->drawRect(r, p);
p.setColor(0xFFAA66FF);
p.setColor(sk_tool_utils::color_to_565(0xFFAA66FF));
r = SkRect::MakeXYWH(x, y + halfH, SkIntToScalar(W), halfH);
canvas->drawRect(r, p);
break;
@ -129,7 +129,7 @@ class XfermodesGM : public GM {
SkScalar h = SkIntToScalar(H);
SkRect r = SkRect::MakeXYWH(x + w / 3, y + h / 3,
w * 37 / 60, h * 37 / 60);
p.setColor(0xFF66AAFF);
p.setColor(sk_tool_utils::color_to_565(0xFF66AAFF));
canvas->drawRect(r, p);
break;
}
@ -232,7 +232,7 @@ protected:
SkPaint labelP;
labelP.setAntiAlias(true);
sk_tool_utils::set_portable_typeface(&labelP);
sk_tool_utils::set_portable_typeface_always(&labelP);
labelP.setTextAlign(SkPaint::kCenter_Align);
const int W = 5;

View File

@ -34,7 +34,7 @@ protected:
SkPaint labelP;
labelP.setAntiAlias(true);
sk_tool_utils::set_portable_typeface(&labelP);
sk_tool_utils::set_portable_typeface_always(&labelP);
labelP.setTextAlign(SkPaint::kCenter_Align);
const int W = 6;
@ -88,10 +88,10 @@ protected:
private:
void onOnceBeforeDraw() override {
static const uint32_t kCheckData[] = {
SkPackARGB32(0xFF, 0x40, 0x40, 0x40),
SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0),
SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0),
SkPackARGB32(0xFF, 0x40, 0x40, 0x40)
SkPackARGB32(0xFF, 0x42, 0x41, 0x42),
SkPackARGB32(0xFF, 0xD6, 0xD3, 0xD6),
SkPackARGB32(0xFF, 0xD6, 0xD3, 0xD6),
SkPackARGB32(0xFF, 0x42, 0x41, 0x42)
};
SkBitmap bg;
bg.allocN32Pixels(2, 2, true);

View File

@ -37,7 +37,7 @@ protected:
void onDrawBackground(SkCanvas* canvas) override {
SkPaint bgPaint;
bgPaint.setColor(0xFF70D0E0);
bgPaint.setColor(sk_tool_utils::color_to_565(0xFF70D0E0));
canvas->drawPaint(bgPaint);
}
@ -46,7 +46,7 @@ protected:
SkPaint labelP;
labelP.setAntiAlias(true);
sk_tool_utils::set_portable_typeface(&labelP);
sk_tool_utils::set_portable_typeface_always(&labelP);
static const SkColor kSolidColors[] = {
SK_ColorTRANSPARENT,
@ -181,10 +181,10 @@ private:
void onOnceBeforeDraw() override {
static const uint32_t kCheckData[] = {
SkPackARGB32(0xFF, 0x40, 0x40, 0x40),
SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0),
SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0),
SkPackARGB32(0xFF, 0x40, 0x40, 0x40)
SkPackARGB32(0xFF, 0x42, 0x41, 0x42),
SkPackARGB32(0xFF, 0xD6, 0xD3, 0xD6),
SkPackARGB32(0xFF, 0xD6, 0xD3, 0xD6),
SkPackARGB32(0xFF, 0x42, 0x41, 0x42)
};
SkBitmap bg;
bg.allocN32Pixels(2, 2, true);