OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrClipMaskManager.h" | 8 #include "GrClipMaskManager.h" |
9 #include "GrCaps.h" | 9 #include "GrCaps.h" |
10 #include "GrDrawingManager.h" | 10 #include "GrDrawingManager.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 467 |
468 // There's no texture in the cache. Let's try to allocate it then. | 468 // There's no texture in the cache. Let's try to allocate it then. |
469 GrPixelConfig config = kRGBA_8888_GrPixelConfig; | 469 GrPixelConfig config = kRGBA_8888_GrPixelConfig; |
470 if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { | 470 if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { |
471 config = kAlpha_8_GrPixelConfig; | 471 config = kAlpha_8_GrPixelConfig; |
472 } | 472 } |
473 | 473 |
474 sk_sp<GrDrawContext> dc(context->newDrawContext(SkBackingFit::kApprox, | 474 sk_sp<GrDrawContext> dc(context->newDrawContext(SkBackingFit::kApprox, |
475 clipSpaceIBounds.width(), | 475 clipSpaceIBounds.width(), |
476 clipSpaceIBounds.height(), | 476 clipSpaceIBounds.height(), |
477 config)); | 477 config, nullptr)); |
478 if (!dc) { | 478 if (!dc) { |
479 return nullptr; | 479 return nullptr; |
480 } | 480 } |
481 | 481 |
482 // The texture may be larger than necessary, this rect represents the part o
f the texture | 482 // The texture may be larger than necessary, this rect represents the part o
f the texture |
483 // we populate with a rasterization of the clip. | 483 // we populate with a rasterization of the clip. |
484 SkIRect maskSpaceIBounds = SkIRect::MakeWH(clipSpaceIBounds.width(), clipSpa
ceIBounds.height()); | 484 SkIRect maskSpaceIBounds = SkIRect::MakeWH(clipSpaceIBounds.width(), clipSpa
ceIBounds.height()); |
485 | 485 |
486 // The scratch texture that we are drawing into can be substantially larger
than the mask. Only | 486 // The scratch texture that we are drawing into can be substantially larger
than the mask. Only |
487 // clear the part that we care about. | 487 // clear the part that we care about. |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 sk_sp<GrTexture> result(texProvider->createApproxTexture(desc)); | 810 sk_sp<GrTexture> result(texProvider->createApproxTexture(desc)); |
811 if (!result) { | 811 if (!result) { |
812 return nullptr; | 812 return nullptr; |
813 } | 813 } |
814 result->resourcePriv().setUniqueKey(key); | 814 result->resourcePriv().setUniqueKey(key); |
815 | 815 |
816 helper.toTexture(result.get()); | 816 helper.toTexture(result.get()); |
817 | 817 |
818 return result; | 818 return result; |
819 } | 819 } |
OLD | NEW |