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

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

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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/SkGlyphCache_Globals.h ('k') | src/core/SkImageFilter.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 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"
(...skipping 27 matching lines...) Expand all
38 return nullptr; 38 return nullptr;
39 } 39 }
40 if (*subset != bounds) { 40 if (*subset != bounds) {
41 // we need a different uniqueID since we really are a subset of the raw generator 41 // we need a different uniqueID since we really are a subset of the raw generator
42 uniqueID = SkNextID::ImageID(); 42 uniqueID = SkNextID::ImageID();
43 } 43 }
44 } else { 44 } else {
45 subset = &bounds; 45 subset = &bounds;
46 } 46 }
47 47
48 return SkNEW_ARGS(SkImageCacherator, (gen, 48 return new SkImageCacherator(gen, gen->getInfo().makeWH(subset->width(), sub set->height()),
49 gen->getInfo().makeWH(subset->width(), subset->height()), 49 SkIPoint::Make(subset->x(), subset->y()), uniqu eID);
50 SkIPoint::Make(subset->x(), subset->y( )),
51 uniqueID));
52 } 50 }
53 51
54 SkImageCacherator::SkImageCacherator(SkImageGenerator* gen, const SkImageInfo& i nfo, 52 SkImageCacherator::SkImageCacherator(SkImageGenerator* gen, const SkImageInfo& i nfo,
55 const SkIPoint& origin, uint32_t uniqueID) 53 const SkIPoint& origin, uint32_t uniqueID)
56 : fGenerator(gen) 54 : fGenerator(gen)
57 , fInfo(info) 55 , fInfo(info)
58 , fOrigin(origin) 56 , fOrigin(origin)
59 , fUniqueID(uniqueID) 57 , fUniqueID(uniqueID)
60 {} 58 {}
61 59
62 SkImageCacherator::~SkImageCacherator() { 60 SkImageCacherator::~SkImageCacherator() { delete fGenerator; }
63 SkDELETE(fGenerator);
64 }
65 61
66 static bool check_output_bitmap(const SkBitmap& bitmap, uint32_t expectedID) { 62 static bool check_output_bitmap(const SkBitmap& bitmap, uint32_t expectedID) {
67 SkASSERT(bitmap.getGenerationID() == expectedID); 63 SkASSERT(bitmap.getGenerationID() == expectedID);
68 SkASSERT(bitmap.isImmutable()); 64 SkASSERT(bitmap.isImmutable());
69 SkASSERT(bitmap.getPixels()); 65 SkASSERT(bitmap.getPixels());
70 return true; 66 return true;
71 } 67 }
72 68
73 static bool generate_bitmap(SkBitmap* bitmap, const SkImageInfo& info, const SkI Point& origin, 69 static bool generate_bitmap(SkBitmap* bitmap, const SkImageInfo& info, const SkI Point& origin,
74 SkImageGenerator* generator) { 70 SkImageGenerator* generator) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 SkBitmap bitmap; 186 SkBitmap bitmap;
191 if (!generate_bitmap(&bitmap, fInfo, fOrigin, fGenerator)) { 187 if (!generate_bitmap(&bitmap, fInfo, fOrigin, fGenerator)) {
192 return nullptr; 188 return nullptr;
193 } 189 }
194 return GrRefCachedBitmapTexture(ctx, bitmap, usage); 190 return GrRefCachedBitmapTexture(ctx, bitmap, usage);
195 #else 191 #else
196 return nullptr; 192 return nullptr;
197 #endif 193 #endif
198 } 194 }
199 195
OLDNEW
« no previous file with comments | « src/core/SkGlyphCache_Globals.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698