| OLD | NEW |
| 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 "SkImage_Base.h" | 10 #include "SkImage_Base.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 return set_key_and_return(tex, key); | 266 return set_key_and_return(tex, key); |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 return nullptr; | 269 return nullptr; |
| 270 } | 270 } |
| 271 | 271 |
| 272 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 272 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 273 | 273 |
| 274 #include "GrTextureParamsAdjuster.h" | 274 #include "GrTextureParamsAdjuster.h" |
| 275 | 275 |
| 276 class Cacherator_GrTextureParamsAdjuster : public GrTextureParamsAdjuster { | 276 class Cacherator_GrTextureMaker : public GrTextureMaker { |
| 277 public: | 277 public: |
| 278 Cacherator_GrTextureParamsAdjuster(SkImageCacherator* cacher, const SkImage*
client) | 278 Cacherator_GrTextureMaker(SkImageCacherator* cacher, const SkImage* client) |
| 279 : INHERITED(cacher->info().width(), cacher->info().height()) | 279 : INHERITED(cacher->info().width(), cacher->info().height()) |
| 280 , fCacher(cacher) | 280 , fCacher(cacher) |
| 281 , fClient(client) | 281 , fClient(client) |
| 282 { | 282 { |
| 283 if (client) { | 283 if (client) { |
| 284 GrMakeKeyFromImageID(&fOriginalKey, client->uniqueID(), | 284 GrMakeKeyFromImageID(&fOriginalKey, client->uniqueID(), |
| 285 SkIRect::MakeWH(this->width(), this->height()))
; | 285 SkIRect::MakeWH(this->width(), this->height()))
; |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 | 288 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 305 if (fClient) { | 305 if (fClient) { |
| 306 as_IB(fClient)->notifyAddedToCache(); | 306 as_IB(fClient)->notifyAddedToCache(); |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 | 309 |
| 310 private: | 310 private: |
| 311 SkImageCacherator* fCacher; | 311 SkImageCacherator* fCacher; |
| 312 const SkImage* fClient; | 312 const SkImage* fClient; |
| 313 GrUniqueKey fOriginalKey; | 313 GrUniqueKey fOriginalKey; |
| 314 | 314 |
| 315 typedef GrTextureParamsAdjuster INHERITED; | 315 typedef GrTextureMaker INHERITED; |
| 316 }; | 316 }; |
| 317 | 317 |
| 318 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam
s& params, | 318 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam
s& params, |
| 319 const SkImage* client) { | 319 const SkImage* client) { |
| 320 if (!ctx) { | 320 if (!ctx) { |
| 321 return nullptr; | 321 return nullptr; |
| 322 } | 322 } |
| 323 | 323 |
| 324 return Cacherator_GrTextureParamsAdjuster(this, client).refTextureForParams(
ctx, params); | 324 return Cacherator_GrTextureMaker(this, client).refTextureForParams(ctx, para
ms); |
| 325 } | 325 } |
| 326 | 326 |
| 327 #else | 327 #else |
| 328 | 328 |
| 329 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam
s&, | 329 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam
s&, |
| 330 const SkImage* client) { | 330 const SkImage* client) { |
| 331 return nullptr; | 331 return nullptr; |
| 332 } | 332 } |
| 333 | 333 |
| 334 #endif | 334 #endif |
| OLD | NEW |