Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: tests/WritePixelsTest.cpp

Issue 2396953002: Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints" (Closed)
Patch Set: add tmp virtual to unroll legacy arithmodes Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/SerializationTest.cpp ('k') | tools/debugger/SkDebugCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « tests/SerializationTest.cpp ('k') | tools/debugger/SkDebugCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698