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

Side by Side Diff: tests/ImageDecodingTest.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 } 689 }
690 690
691 691
692 //////////////////////////////////////////////////////////////////////////////// 692 ////////////////////////////////////////////////////////////////////////////////
693 namespace { 693 namespace {
694 class SingleAllocator : public SkBitmap::Allocator { 694 class SingleAllocator : public SkBitmap::Allocator {
695 public: 695 public:
696 SingleAllocator(void* p, size_t s) : fPixels(p), fSize(s) { } 696 SingleAllocator(void* p, size_t s) : fPixels(p), fSize(s) { }
697 ~SingleAllocator() {} 697 ~SingleAllocator() {}
698 // If the pixels in fPixels are big enough, use them. 698 // If the pixels in fPixels are big enough, use them.
699 bool allocPixelRef(SkBitmap* bm, SkColorTable* ct) SK_OVERRIDE { 699 bool allocPixelRef(SkBitmap* bm, SkColorTable* ct) override {
700 SkASSERT(bm); 700 SkASSERT(bm);
701 if (bm->info().getSafeSize(bm->rowBytes()) <= fSize) { 701 if (bm->info().getSafeSize(bm->rowBytes()) <= fSize) {
702 bm->setPixels(fPixels, ct); 702 bm->setPixels(fPixels, ct);
703 fPixels = NULL; 703 fPixels = NULL;
704 fSize = 0; 704 fSize = 0;
705 return true; 705 return true;
706 } 706 }
707 return bm->tryAllocPixels(NULL, ct); 707 return bm->tryAllocPixels(NULL, ct);
708 } 708 }
709 bool ready() { return fPixels != NULL; } 709 bool ready() { return fPixels != NULL; }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 ((void*)pixels.get(), sizeof(uint16_t) * pixelCount))); 744 ((void*)pixels.get(), sizeof(uint16_t) * pixelCount)));
745 decoder->setAllocator(allocator); 745 decoder->setAllocator(allocator);
746 decoder->setSampleSize(2); 746 decoder->setSampleSize(2);
747 SkBitmap bitmap; 747 SkBitmap bitmap;
748 bool success = decoder->decode(stream, &bitmap, kRGB_565_SkColorType, 748 bool success = decoder->decode(stream, &bitmap, kRGB_565_SkColorType,
749 SkImageDecoder::kDecodePixels_Mode) != SkImag eDecoder::kFailure; 749 SkImageDecoder::kDecodePixels_Mode) != SkImag eDecoder::kFailure;
750 REPORTER_ASSERT(r, success); 750 REPORTER_ASSERT(r, success);
751 REPORTER_ASSERT(r, !allocator->ready()); // Decoder used correct memory 751 REPORTER_ASSERT(r, !allocator->ready()); // Decoder used correct memory
752 REPORTER_ASSERT(r, sentinal == pixels[pixelCount]); 752 REPORTER_ASSERT(r, sentinal == pixels[pixelCount]);
753 } 753 }
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