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