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

Side by Side Diff: tests/CachedDecodingPixelRefTest.cpp

Issue 1263013002: Remove SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « src/ports/SkImageGenerator_skia.cpp ('k') | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCachingPixelRef.h" 9 #include "SkCachingPixelRef.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 SkASSERT((fType <= kLast_TestType) && (fType >= 0)); 175 SkASSERT((fType <= kLast_TestType) && (fType >= 0));
176 } 176 }
177 virtual ~TestImageGenerator() { } 177 virtual ~TestImageGenerator() { }
178 178
179 protected: 179 protected:
180 static SkImageInfo GetMyInfo() { 180 static SkImageInfo GetMyInfo() {
181 return SkImageInfo::MakeN32(TestImageGenerator::Width(), TestImageGenera tor::Height(), 181 return SkImageInfo::MakeN32(TestImageGenerator::Width(), TestImageGenera tor::Height(),
182 kOpaque_SkAlphaType); 182 kOpaque_SkAlphaType);
183 } 183 }
184 184
185 #ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
186 Result onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
187 const Options&,
188 SkPMColor ctable[], int* ctableCount) override {
189 #else
190 bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, 185 bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
191 SkPMColor ctable[], int* ctableCount) override { 186 SkPMColor ctable[], int* ctableCount) override {
192 #endif
193 REPORTER_ASSERT(fReporter, pixels != NULL); 187 REPORTER_ASSERT(fReporter, pixels != NULL);
194 REPORTER_ASSERT(fReporter, rowBytes >= info.minRowBytes()); 188 REPORTER_ASSERT(fReporter, rowBytes >= info.minRowBytes());
195 if (fType != kSucceedGetPixels_TestType) { 189 if (fType != kSucceedGetPixels_TestType) {
196 #ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
197 return kUnimplemented;
198 #else
199 return false; 190 return false;
200 #endif
201 } 191 }
202 if (info.colorType() != kN32_SkColorType) { 192 if (info.colorType() != kN32_SkColorType) {
203 #ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
204 return kInvalidConversion;
205 #else
206 return false; 193 return false;
207 #endif
208 } 194 }
209 char* bytePtr = static_cast<char*>(pixels); 195 char* bytePtr = static_cast<char*>(pixels);
210 for (int y = 0; y < info.height(); ++y) { 196 for (int y = 0; y < info.height(); ++y) {
211 sk_memset32(reinterpret_cast<SkColor*>(bytePtr), 197 sk_memset32(reinterpret_cast<SkColor*>(bytePtr),
212 TestImageGenerator::Color(), info.width()); 198 TestImageGenerator::Color(), info.width());
213 bytePtr += rowBytes; 199 bytePtr += rowBytes;
214 } 200 }
215 #ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
216 return kSuccess;
217 #else
218 return true; 201 return true;
219 #endif
220 } 202 }
221 203
222 private: 204 private:
223 const TestType fType; 205 const TestType fType;
224 skiatest::Reporter* const fReporter; 206 skiatest::Reporter* const fReporter;
225 207
226 typedef SkImageGenerator INHERITED; 208 typedef SkImageGenerator INHERITED;
227 }; 209 };
228 210
229 static void check_test_image_generator_bitmap(skiatest::Reporter* reporter, 211 static void check_test_image_generator_bitmap(skiatest::Reporter* reporter,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 canvas.clear(kDefaultColor); 334 canvas.clear(kDefaultColor);
353 canvas.drawImage(image, 0, 0, NULL); 335 canvas.drawImage(image, 0, 0, NULL);
354 if (TestImageGenerator::kSucceedGetPixels_TestType == test) { 336 if (TestImageGenerator::kSucceedGetPixels_TestType == test) {
355 REPORTER_ASSERT( 337 REPORTER_ASSERT(
356 r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0)); 338 r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0));
357 } else { 339 } else {
358 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0,0)); 340 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0,0));
359 } 341 }
360 } 342 }
361 } 343 }
OLDNEW
« no previous file with comments | « src/ports/SkImageGenerator_skia.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698