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

Side by Side Diff: tests/ReadWriteAlphaTest.cpp

Issue 1205643002: Make SkGpuDevice know its alpha type (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix bench pictures :( Created 5 years, 6 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/PremulAlphaRoundTripTest.cpp ('k') | tests/SurfaceTest.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 2012 Google Inc. 2 * Copyright 2012 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 "Test.h" 8 #include "Test.h"
9 9
10 // This test is specific to the GPU backend. 10 // This test is specific to the GPU backend.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if (textureData[x][y] != readback[x][y]) { 76 if (textureData[x][y] != readback[x][y]) {
77 match = false; 77 match = false;
78 } 78 }
79 } 79 }
80 } 80 }
81 81
82 REPORTER_ASSERT(reporter, match); 82 REPORTER_ASSERT(reporter, match);
83 83
84 // Now try writing on the single channel texture 84 // Now try writing on the single channel texture
85 SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); 85 SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
86 SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(texture->asRenderT arget(), &props)); 86 SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(texture->asRenderT arget(), &props,
87 SkGpuDevice::kUnin it_InitContents));
87 SkCanvas canvas(device); 88 SkCanvas canvas(device);
88 89
89 SkPaint paint; 90 SkPaint paint;
90 91
91 const SkRect rect = SkRect::MakeLTRB(-10, -10, X_SIZE + 10, Y_SIZE + 10) ; 92 const SkRect rect = SkRect::MakeLTRB(-10, -10, X_SIZE + 10, Y_SIZE + 10) ;
92 93
93 paint.setColor(SK_ColorWHITE); 94 paint.setColor(SK_ColorWHITE);
94 95
95 canvas.drawRect(rect, paint); 96 canvas.drawRect(rect, paint);
96 97
97 texture->readPixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, 98 texture->readPixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
98 readback, 0); 99 readback, 0);
99 100
100 match = true; 101 match = true;
101 102
102 for (int y = 0; y < Y_SIZE; ++y) { 103 for (int y = 0; y < Y_SIZE; ++y) {
103 for (int x = 0; x < X_SIZE; ++x) { 104 for (int x = 0; x < X_SIZE; ++x) {
104 if (0xFF != readback[x][y]) { 105 if (0xFF != readback[x][y]) {
105 match = false; 106 match = false;
106 } 107 }
107 } 108 }
108 } 109 }
109 110
110 REPORTER_ASSERT(reporter, match); 111 REPORTER_ASSERT(reporter, match);
111 } 112 }
112 } 113 }
113 114
114 #endif 115 #endif
OLDNEW
« no previous file with comments | « tests/PremulAlphaRoundTripTest.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698