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

Side by Side Diff: tests/PremulAlphaRoundTripTest.cpp

Issue 848903004: Require budget decision when creating a RenderTarget SkSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address initial comments Created 5 years, 11 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
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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkConfig8888.h" 10 #include "SkConfig8888.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 SkAutoTUnref<SkBaseDevice> device; 78 SkAutoTUnref<SkBaseDevice> device;
79 if (0 == dtype) { 79 if (0 == dtype) {
80 device.reset(SkBitmapDevice::Create(info)); 80 device.reset(SkBitmapDevice::Create(info));
81 } else { 81 } else {
82 #if SK_SUPPORT_GPU 82 #if SK_SUPPORT_GPU
83 GrContextFactory::GLContextType type = 83 GrContextFactory::GLContextType type =
84 static_cast<GrContextFactory::GLContextType>(glCtxType); 84 static_cast<GrContextFactory::GLContextType>(glCtxType);
85 if (!GrContextFactory::IsRenderingGLContext(type)) { 85 if (!GrContextFactory::IsRenderingGLContext(type)) {
86 continue; 86 continue;
87 } 87 }
88 GrContext* context = factory->get(type); 88 GrContext* ctx = factory->get(type);
89 if (NULL == context) { 89 if (NULL == ctx) {
90 continue; 90 continue;
91 } 91 }
92 92 SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
93 device.reset(SkGpuDevice::Create(context, info, 93 device.reset(SkGpuDevice::Create(ctx, SkSurface::kNo_Budgeted, i nfo, 0, &props));
94 SkSurfaceProps(SkSurfaceProps::kLegacyFontH ost_InitType), 0));
95 #else 94 #else
96 continue; 95 continue;
97 #endif 96 #endif
98 } 97 }
99 SkCanvas canvas(device); 98 SkCanvas canvas(device);
100 99
101 for (size_t upmaIdx = 0; upmaIdx < SK_ARRAY_COUNT(gUnpremul); ++upma Idx) { 100 for (size_t upmaIdx = 0; upmaIdx < SK_ARRAY_COUNT(gUnpremul); ++upma Idx) {
102 fillCanvas(&canvas, gUnpremul[upmaIdx].fColorType, gUnpremul[upm aIdx].fPackProc); 101 fillCanvas(&canvas, gUnpremul[upmaIdx].fColorType, gUnpremul[upm aIdx].fPackProc);
103 102
104 const SkImageInfo info = SkImageInfo::Make(256, 256, gUnpremul[u pmaIdx].fColorType, 103 const SkImageInfo info = SkImageInfo::Make(256, 256, gUnpremul[u pmaIdx].fColorType,
(...skipping 20 matching lines...) Expand all
125 if (pixels1[x] != pixels2[x]) { 124 if (pixels1[x] != pixels2[x]) {
126 SkDebugf("%x != %x, x = %d, y = %d\n", pixels1[x], p ixels2[x], x, y); 125 SkDebugf("%x != %x, x = %d, y = %d\n", pixels1[x], p ixels2[x], x, y);
127 } 126 }
128 REPORTER_ASSERT(reporter, success = pixels1[x] == pixels 2[x]); 127 REPORTER_ASSERT(reporter, success = pixels1[x] == pixels 2[x]);
129 } 128 }
130 } 129 }
131 } 130 }
132 } 131 }
133 } 132 }
134 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698