OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 8 |
9 #include "SkGr.h" | 9 #include "SkGr.h" |
10 | 10 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 public: | 339 public: |
340 explicit TextureBitmap_GrTextureAdjuster(const SkBitmap* bmp) | 340 explicit TextureBitmap_GrTextureAdjuster(const SkBitmap* bmp) |
341 : INHERITED(bmp->getTexture(), SkIRect::MakeWH(bmp->width(), bmp->height
())) | 341 : INHERITED(bmp->getTexture(), SkIRect::MakeWH(bmp->width(), bmp->height
())) |
342 , fBmp(bmp) {} | 342 , fBmp(bmp) {} |
343 | 343 |
344 private: | 344 private: |
345 void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override { | 345 void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override { |
346 if (fBmp->isVolatile()) { | 346 if (fBmp->isVolatile()) { |
347 return; | 347 return; |
348 } | 348 } |
349 // The texture subset must represent the whole bitmap. Texture-backed bi
tmaps don't support | 349 // The content area must represent the whole bitmap. Texture-backed bitm
aps don't support |
350 // extractSubset(). Therefore, either the bitmap and the teture are the
same size or the | 350 // extractSubset(). Therefore, either the bitmap and the texture are the
same size or the |
351 // subset's dimensions are the bitmap's dimensions. | 351 // content's dimensions are the bitmap's dimensions which is pinned to t
he upper left |
| 352 // of the texture. |
352 GrUniqueKey baseKey; | 353 GrUniqueKey baseKey; |
353 GrMakeKeyFromImageID(&baseKey, fBmp->getGenerationID(), | 354 GrMakeKeyFromImageID(&baseKey, fBmp->getGenerationID(), |
354 SkIRect::MakeWH(fBmp->width(), fBmp->height())); | 355 SkIRect::MakeWH(fBmp->width(), fBmp->height())); |
355 MakeCopyKeyFromOrigKey(baseKey, params, copyKey); | 356 MakeCopyKeyFromOrigKey(baseKey, params, copyKey); |
356 } | 357 } |
357 | 358 |
358 void didCacheCopy(const GrUniqueKey& copyKey) override { | 359 void didCacheCopy(const GrUniqueKey& copyKey) override { |
359 install_bmp_key_invalidator(copyKey, fBmp->pixelRef()); | 360 install_bmp_key_invalidator(copyKey, fBmp->pixelRef()); |
360 } | 361 } |
361 | 362 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 SkErrorInternals::SetError( kInvalidPaint_SkError, | 684 SkErrorInternals::SetError( kInvalidPaint_SkError, |
684 "Sorry, I don't understand the filtering
" | 685 "Sorry, I don't understand the filtering
" |
685 "mode you asked for. Falling back to " | 686 "mode you asked for. Falling back to " |
686 "MIPMaps."); | 687 "MIPMaps."); |
687 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 688 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
688 break; | 689 break; |
689 | 690 |
690 } | 691 } |
691 return textureFilterMode; | 692 return textureFilterMode; |
692 } | 693 } |
OLD | NEW |