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

Side by Side Diff: tests/ImageDecodingTest.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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
« no previous file with comments | « tests/ImageCacheTest.cpp ('k') | tests/ImageFilterTest.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 * 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 "Resources.h" 8 #include "Resources.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 } 753 }
754 754
755 755
756 //////////////////////////////////////////////////////////////////////////////// 756 ////////////////////////////////////////////////////////////////////////////////
757 namespace { 757 namespace {
758 class SingleAllocator : public SkBitmap::Allocator { 758 class SingleAllocator : public SkBitmap::Allocator {
759 public: 759 public:
760 SingleAllocator(void* p, size_t s) : fPixels(p), fSize(s) { } 760 SingleAllocator(void* p, size_t s) : fPixels(p), fSize(s) { }
761 ~SingleAllocator() {} 761 ~SingleAllocator() {}
762 // If the pixels in fPixels are big enough, use them. 762 // If the pixels in fPixels are big enough, use them.
763 virtual bool allocPixelRef(SkBitmap* bm, SkColorTable* ct) SK_OVERRIDE { 763 bool allocPixelRef(SkBitmap* bm, SkColorTable* ct) SK_OVERRIDE {
764 SkASSERT(bm); 764 SkASSERT(bm);
765 if (bm->info().getSafeSize(bm->rowBytes()) <= fSize) { 765 if (bm->info().getSafeSize(bm->rowBytes()) <= fSize) {
766 bm->setPixels(fPixels, ct); 766 bm->setPixels(fPixels, ct);
767 fPixels = NULL; 767 fPixels = NULL;
768 fSize = 0; 768 fSize = 0;
769 return true; 769 return true;
770 } 770 }
771 return bm->tryAllocPixels(NULL, ct); 771 return bm->tryAllocPixels(NULL, ct);
772 } 772 }
773 bool ready() { return fPixels != NULL; } 773 bool ready() { return fPixels != NULL; }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 ((void*)pixels.get(), sizeof(uint16_t) * pixelCount))); 808 ((void*)pixels.get(), sizeof(uint16_t) * pixelCount)));
809 decoder->setAllocator(allocator); 809 decoder->setAllocator(allocator);
810 decoder->setSampleSize(2); 810 decoder->setSampleSize(2);
811 SkBitmap bitmap; 811 SkBitmap bitmap;
812 bool success = decoder->decode(stream, &bitmap, kRGB_565_SkColorType, 812 bool success = decoder->decode(stream, &bitmap, kRGB_565_SkColorType,
813 SkImageDecoder::kDecodePixels_Mode) != SkImag eDecoder::kFailure; 813 SkImageDecoder::kDecodePixels_Mode) != SkImag eDecoder::kFailure;
814 REPORTER_ASSERT(r, success); 814 REPORTER_ASSERT(r, success);
815 REPORTER_ASSERT(r, !allocator->ready()); // Decoder used correct memory 815 REPORTER_ASSERT(r, !allocator->ready()); // Decoder used correct memory
816 REPORTER_ASSERT(r, sentinal == pixels[pixelCount]); 816 REPORTER_ASSERT(r, sentinal == pixels[pixelCount]);
817 } 817 }
OLDNEW
« no previous file with comments | « tests/ImageCacheTest.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698