| OLD | NEW |
| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_SUPPORT_LEGACY_BOOL_ONGETINFO | 185 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO |
| 186 bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { | 186 bool onGetInfo(SkImageInfo* info) override { |
| 187 REPORTER_ASSERT(fReporter, info); | 187 REPORTER_ASSERT(fReporter, info); |
| 188 *info = GetMyInfo(); | 188 *info = GetMyInfo(); |
| 189 return true; | 189 return true; |
| 190 } | 190 } |
| 191 #endif | 191 #endif |
| 192 | 192 |
| 193 virtual Result onGetPixels(const SkImageInfo& info, void* pixels, size_t row
Bytes, | 193 virtual Result onGetPixels(const SkImageInfo& info, void* pixels, size_t row
Bytes, |
| 194 const Options&, | 194 const Options&, |
| 195 SkPMColor ctable[], int* ctableCount) SK_OVERRIDE
{ | 195 SkPMColor ctable[], int* ctableCount) override { |
| 196 REPORTER_ASSERT(fReporter, pixels != NULL); | 196 REPORTER_ASSERT(fReporter, pixels != NULL); |
| 197 REPORTER_ASSERT(fReporter, rowBytes >= info.minRowBytes()); | 197 REPORTER_ASSERT(fReporter, rowBytes >= info.minRowBytes()); |
| 198 if (fType != kSucceedGetPixels_TestType) { | 198 if (fType != kSucceedGetPixels_TestType) { |
| 199 return kUnimplemented; | 199 return kUnimplemented; |
| 200 } | 200 } |
| 201 if (info.colorType() != kN32_SkColorType) { | 201 if (info.colorType() != kN32_SkColorType) { |
| 202 return kInvalidConversion; | 202 return kInvalidConversion; |
| 203 } | 203 } |
| 204 char* bytePtr = static_cast<char*>(pixels); | 204 char* bytePtr = static_cast<char*>(pixels); |
| 205 for (int y = 0; y < info.height(); ++y) { | 205 for (int y = 0; y < info.height(); ++y) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 canvas.clear(kDefaultColor); | 341 canvas.clear(kDefaultColor); |
| 342 canvas.drawImage(image, 0, 0, NULL); | 342 canvas.drawImage(image, 0, 0, NULL); |
| 343 if (TestImageGenerator::kSucceedGetPixels_TestType == test) { | 343 if (TestImageGenerator::kSucceedGetPixels_TestType == test) { |
| 344 REPORTER_ASSERT( | 344 REPORTER_ASSERT( |
| 345 r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0)); | 345 r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0)); |
| 346 } else { | 346 } else { |
| 347 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0,0)); | 347 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0,0)); |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 } | 350 } |
| OLD | NEW |