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

Side by Side Diff: src/core/SkImageCacherator.cpp

Issue 1295593002: some catchup CL revisions (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/core/SkImageCacherator.h ('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 2015 Google Inc. 2 * Copyright 2015 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 "SkBitmapCache.h" 9 #include "SkBitmapCache.h"
10 #include "SkImageCacherator.h" 10 #include "SkImageCacherator.h"
11 #include "SkPixelRef.h" 11 #include "SkPixelRef.h"
12 12
13 #if SK_SUPPORT_GPU 13 #if SK_SUPPORT_GPU
14 #include "GrContext.h" 14 #include "GrContext.h"
15 #include "GrGpuResourcePriv.h" 15 #include "GrGpuResourcePriv.h"
16 #include "GrResourceKey.h" 16 #include "GrResourceKey.h"
17 #include "GrTextureAccess.h" 17 #include "GrTextureAccess.h"
18 #include "SkGr.h" 18 #include "SkGr.h"
19 #include "SkGrPriv.h" 19 #include "SkGrPriv.h"
20 #endif 20 #endif
21 21
22 SkImageCacherator* SkImageCacherator::NewFromGenerator(SkImageGenerator* gen) {
23 if (!gen) {
24 return nullptr;
25 }
26 return SkNEW_ARGS(SkImageCacherator, (gen));
27 }
28
22 SkImageCacherator::SkImageCacherator(SkImageGenerator* gen) : fGenerator(gen) {} 29 SkImageCacherator::SkImageCacherator(SkImageGenerator* gen) : fGenerator(gen) {}
23 30
24 SkImageCacherator::~SkImageCacherator() { 31 SkImageCacherator::~SkImageCacherator() {
25 delete fGenerator; 32 SkDELETE(fGenerator);
26 } 33 }
27 34
28 static bool check_output_bitmap(const SkBitmap& bitmap, uint32_t expectedID) { 35 static bool check_output_bitmap(const SkBitmap& bitmap, uint32_t expectedID) {
29 SkASSERT(bitmap.getGenerationID() == expectedID); 36 SkASSERT(bitmap.getGenerationID() == expectedID);
30 SkASSERT(bitmap.isImmutable()); 37 SkASSERT(bitmap.isImmutable());
31 SkASSERT(bitmap.getPixels()); 38 SkASSERT(bitmap.getPixels());
32 return true; 39 return true;
33 } 40 }
34 41
35 static bool generate_bitmap(SkImageGenerator* generator, SkBitmap* bitmap) { 42 static bool generate_bitmap(SkImageGenerator* generator, SkBitmap* bitmap) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 SkBitmap bitmap; 142 SkBitmap bitmap;
136 if (!generate_bitmap(fGenerator, &bitmap)) { 143 if (!generate_bitmap(fGenerator, &bitmap)) {
137 return nullptr; 144 return nullptr;
138 } 145 }
139 return GrRefCachedBitmapTexture(ctx, bitmap, usage); 146 return GrRefCachedBitmapTexture(ctx, bitmap, usage);
140 #else 147 #else
141 return nullptr; 148 return nullptr;
142 #endif 149 #endif
143 } 150 }
144 151
OLDNEW
« no previous file with comments | « src/core/SkImageCacherator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698