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

Side by Side Diff: tests/GpuBitmapCopyTest.cpp

Issue 178003003: Do not define SK_SUPPORT_DEEPCOPYTO_CONFIG in Skia. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix error of unused-function Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkBitmap.h ('k') | tools/render_pdfs_main.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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 10
11 #include "GrContext.h" 11 #include "GrContext.h"
12 #include "GrContextFactory.h" 12 #include "GrContextFactory.h"
13 #include "SkBitmap.h" 13 #include "SkBitmap.h"
14 #include "SkCanvas.h" 14 #include "SkCanvas.h"
15 #include "SkColor.h" 15 #include "SkColor.h"
16 #include "SkGpuDevice.h" 16 #include "SkGpuDevice.h"
17 #include "SkPaint.h" 17 #include "SkPaint.h"
18 #include "SkPixelRef.h" 18 #include "SkPixelRef.h"
19 #include "SkRect.h" 19 #include "SkRect.h"
20 #include "Test.h" 20 #include "Test.h"
21 21
22 struct Pair {
23 SkColorType fColorType;
24 const char* fValid;
25 };
26
27 #ifdef SK_SUPPORT_DEEPCOPYTO_CONFIG
22 static const char* boolStr(bool value) { 28 static const char* boolStr(bool value) {
23 return value ? "true" : "false"; 29 return value ? "true" : "false";
24 } 30 }
25 31
26 // these are in the same order as the SkBitmap::Config enum 32 // these are in the same order as the SkBitmap::Config enum
27 static const char* gColorTypeName[] = { 33 static const char* gColorTypeName[] = {
28 "None", "8888" 34 "None", "8888"
29 }; 35 };
30 36
31 struct Pair {
32 SkColorType fColorType;
33 const char* fValid;
34 };
35
36 /** 37 /**
37 * Check to ensure that copying a GPU-backed SkBitmap behaved as expected. 38 * Check to ensure that copying a GPU-backed SkBitmap behaved as expected.
38 * @param reporter Used to report failures. 39 * @param reporter Used to report failures.
39 * @param desiredCT colorType being copied to. If the copy succeeded, dst must have this Config. 40 * @param desiredCT colorType being copied to. If the copy succeeded, dst must have this Config.
40 * @param success True if the copy succeeded. 41 * @param success True if the copy succeeded.
41 * @param src A GPU-backed SkBitmap that had copyTo or deepCopyTo called on it. 42 * @param src A GPU-backed SkBitmap that had copyTo or deepCopyTo called on it.
42 * @param dst SkBitmap that was copied to. 43 * @param dst SkBitmap that was copied to.
43 * @param expectSameGenID Whether the genIDs should be the same if success is t rue. 44 * @param expectSameGenID Whether the genIDs should be the same if success is t rue.
44 */ 45 */
45 static void TestIndividualCopy(skiatest::Reporter* reporter, const SkColorType d esiredCT, 46 static void TestIndividualCopy(skiatest::Reporter* reporter, const SkColorType d esiredCT,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 REPORTER_ASSERT(reporter, src.getGenerationID() != dst.getGeneration ID()); 93 REPORTER_ASSERT(reporter, src.getGenerationID() != dst.getGeneration ID());
93 } 94 }
94 } else { 95 } else {
95 // dst should be unchanged from its initial state 96 // dst should be unchanged from its initial state
96 REPORTER_ASSERT(reporter, dst.config() == SkBitmap::kNo_Config); 97 REPORTER_ASSERT(reporter, dst.config() == SkBitmap::kNo_Config);
97 REPORTER_ASSERT(reporter, dst.width() == 0); 98 REPORTER_ASSERT(reporter, dst.width() == 0);
98 REPORTER_ASSERT(reporter, dst.height() == 0); 99 REPORTER_ASSERT(reporter, dst.height() == 0);
99 } 100 }
100 101
101 } 102 }
103 #endif
102 104
103 // Stripped down version of TestBitmapCopy that checks basic fields (width, heig ht, config, genID) 105 // Stripped down version of TestBitmapCopy that checks basic fields (width, heig ht, config, genID)
104 // to ensure that they were copied properly. 106 // to ensure that they were copied properly.
105 DEF_GPUTEST(GpuBitmapCopy, reporter, factory) { 107 DEF_GPUTEST(GpuBitmapCopy, reporter, factory) {
106 #ifdef SK_BUILD_FOR_ANDROID // https://code.google.com/p/skia/issues/detail?id=7 53 108 #ifdef SK_BUILD_FOR_ANDROID // https://code.google.com/p/skia/issues/detail?id=7 53
107 return; 109 return;
108 #endif 110 #endif
109 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { 111 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
110 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G LContextType>(type); 112 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G LContextType>(type);
111 if (!GrContextFactory::IsRenderingGLContext(glType)) { 113 if (!GrContextFactory::IsRenderingGLContext(glType)) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 TestIndividualCopy(reporter, gPairs[j].fColorType, success, trueSubset, subsetCopy, 232 TestIndividualCopy(reporter, gPairs[j].fColorType, success, trueSubset, subsetCopy,
231 true); 233 true);
232 } 234 }
233 } // for (size_t j = ... 235 } // for (size_t j = ...
234 #endif 236 #endif
235 } // for (size_t i = ... 237 } // for (size_t i = ...
236 } // GrContextFactory::GLContextType 238 } // GrContextFactory::GLContextType
237 } 239 }
238 240
239 #endif 241 #endif
OLDNEW
« no previous file with comments | « include/core/SkBitmap.h ('k') | tools/render_pdfs_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698