OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkMathPriv.h" | 10 #include "SkMathPriv.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 for (int y = 0; y < DEV_H; ++y) { | 115 for (int y = 0; y < DEV_H; ++y) { |
116 for (int x = 0; x < DEV_W; ++x) { | 116 for (int x = 0; x < DEV_W; ++x) { |
117 *bmp.getAddr32(x, y) = get_canvas_color(x, y); | 117 *bmp.getAddr32(x, y) = get_canvas_color(x, y); |
118 } | 118 } |
119 } | 119 } |
120 } | 120 } |
121 canvas->save(); | 121 canvas->save(); |
122 canvas->setMatrix(SkMatrix::I()); | 122 canvas->setMatrix(SkMatrix::I()); |
123 canvas->clipRect(DEV_RECT_S, SkCanvas::kReplace_Op); | 123 canvas->clipRect(DEV_RECT_S, SkCanvas::kReplace_Op); |
124 SkPaint paint; | 124 SkPaint paint; |
125 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 125 paint.setBlendMode(SkBlendMode::kSrc); |
126 canvas->drawBitmap(bmp, 0, 0, &paint); | 126 canvas->drawBitmap(bmp, 0, 0, &paint); |
127 canvas->restore(); | 127 canvas->restore(); |
128 } | 128 } |
129 | 129 |
130 /** | 130 /** |
131 * Lucky for us, alpha is always in the same spot (SK_A32_SHIFT), for both RGBA
and BGRA. | 131 * Lucky for us, alpha is always in the same spot (SK_A32_SHIFT), for both RGBA
and BGRA. |
132 * Thus this routine doesn't need to know the exact colortype | 132 * Thus this routine doesn't need to know the exact colortype |
133 */ | 133 */ |
134 static uint32_t premul(uint32_t color) { | 134 static uint32_t premul(uint32_t color) { |
135 unsigned a = SkGetPackedA32(color); | 135 unsigned a = SkGetPackedA32(color); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) { | 408 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) { |
409 const SkImageInfo ii = SkImageInfo::MakeN32Premul(DEV_W, DEV_H); | 409 const SkImageInfo ii = SkImageInfo::MakeN32Premul(DEV_W, DEV_H); |
410 | 410 |
411 for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin
}) { | 411 for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin
}) { |
412 sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctxInfo.grContext()
, SkBudgeted::kNo, | 412 sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctxInfo.grContext()
, SkBudgeted::kNo, |
413 ii, 0, origin, null
ptr)); | 413 ii, 0, origin, null
ptr)); |
414 test_write_pixels(reporter, surface.get()); | 414 test_write_pixels(reporter, surface.get()); |
415 } | 415 } |
416 } | 416 } |
417 #endif | 417 #endif |
OLD | NEW |