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

Side by Side Diff: tests/WritePixelsTest.cpp

Issue 2355483002: abstract name of clipping ops, to transtion to a more restricted set (Closed)
Patch Set: no need for ifdef for globals Created 4 years, 3 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/SkLiteDLTest.cpp ('k') | tools/debugger/SkDebugCanvas.h » ('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"
11 #include "SkRegion.h"
12 #include "SkSurface.h" 11 #include "SkSurface.h"
13 #include "Test.h" 12 #include "Test.h"
14 #include "sk_tool_utils.h" 13 #include "sk_tool_utils.h"
15 14
16 #if SK_SUPPORT_GPU 15 #if SK_SUPPORT_GPU
17 #include "GrContext.h" 16 #include "GrContext.h"
18 #endif 17 #endif
19 18
20 #include <initializer_list> 19 #include <initializer_list>
21 20
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (bmp.isNull()) { 113 if (bmp.isNull()) {
115 bmp.allocN32Pixels(DEV_W, DEV_H); 114 bmp.allocN32Pixels(DEV_W, DEV_H);
116 for (int y = 0; y < DEV_H; ++y) { 115 for (int y = 0; y < DEV_H; ++y) {
117 for (int x = 0; x < DEV_W; ++x) { 116 for (int x = 0; x < DEV_W; ++x) {
118 *bmp.getAddr32(x, y) = get_canvas_color(x, y); 117 *bmp.getAddr32(x, y) = get_canvas_color(x, y);
119 } 118 }
120 } 119 }
121 } 120 }
122 canvas->save(); 121 canvas->save();
123 canvas->setMatrix(SkMatrix::I()); 122 canvas->setMatrix(SkMatrix::I());
124 canvas->clipRect(DEV_RECT_S, SkRegion::kReplace_Op); 123 canvas->clipRect(DEV_RECT_S, SkCanvas::kReplace_Op);
125 SkPaint paint; 124 SkPaint paint;
126 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 125 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
127 canvas->drawBitmap(bmp, 0, 0, &paint); 126 canvas->drawBitmap(bmp, 0, 0, &paint);
128 canvas->restore(); 127 canvas->restore();
129 } 128 }
130 129
131 /** 130 /**
132 * 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.
133 * Thus this routine doesn't need to know the exact colortype 132 * Thus this routine doesn't need to know the exact colortype
134 */ 133 */
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) { 408 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) {
410 const SkImageInfo ii = SkImageInfo::MakeN32Premul(DEV_W, DEV_H); 409 const SkImageInfo ii = SkImageInfo::MakeN32Premul(DEV_W, DEV_H);
411 410
412 for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) { 411 for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
413 sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctxInfo.grContext() , SkBudgeted::kNo, 412 sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctxInfo.grContext() , SkBudgeted::kNo,
414 ii, 0, origin, null ptr)); 413 ii, 0, origin, null ptr));
415 test_write_pixels(reporter, surface.get()); 414 test_write_pixels(reporter, surface.get());
416 } 415 }
417 } 416 }
418 #endif 417 #endif
OLDNEW
« no previous file with comments | « tests/SkLiteDLTest.cpp ('k') | tools/debugger/SkDebugCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698