| 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 "gm.h" | 8 #include "gm.h" |
| 9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
| 10 #include "GrTest.h" | 10 #include "GrTest.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 protected: | 26 protected: |
| 27 SkString onShortName() override { | 27 SkString onShortName() override { |
| 28 return SkString("big_rrect_aa_effect"); | 28 return SkString("big_rrect_aa_effect"); |
| 29 } | 29 } |
| 30 | 30 |
| 31 SkISize onISize() override { return SkISize::Make(kImageWidth, kImageHeight)
; } | 31 SkISize onISize() override { return SkISize::Make(kImageWidth, kImageHeight)
; } |
| 32 | 32 |
| 33 void onDraw(SkCanvas* canvas) override { | 33 void onDraw(SkCanvas* canvas) override { |
| 34 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 34 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
| 35 GrContext* context = rt ? rt->getContext() : NULL; | 35 GrContext* context = rt ? rt->getContext() : nullptr; |
| 36 if (!context) { | 36 if (!context) { |
| 37 this->drawGpuOnlyMessage(canvas); | 37 this->drawGpuOnlyMessage(canvas); |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 | 40 |
| 41 SkPaint paint; | 41 SkPaint paint; |
| 42 | 42 |
| 43 #ifdef SK_DEBUG | 43 #ifdef SK_DEBUG |
| 44 static const SkRect kMaxRRectBound = SkRect::MakeWH(SkIntToScalar(kMaxSi
ze), | 44 static const SkRect kMaxRRectBound = SkRect::MakeWH(SkIntToScalar(kMaxSi
ze), |
| 45 SkIntToScalar(kMaxSi
ze)); | 45 SkIntToScalar(kMaxSi
ze)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 59 #ifdef SK_DEBUG | 59 #ifdef SK_DEBUG |
| 60 SkASSERT(kMaxRRectBound.contains(fRRects[curRRect].getBounds()))
; | 60 SkASSERT(kMaxRRectBound.contains(fRRects[curRRect].getBounds()))
; |
| 61 SkRect imageSpaceBounds = fRRects[curRRect].getBounds(); | 61 SkRect imageSpaceBounds = fRRects[curRRect].getBounds(); |
| 62 imageSpaceBounds.offset(SkIntToScalar(x), SkIntToScalar(y)); | 62 imageSpaceBounds.offset(SkIntToScalar(x), SkIntToScalar(y)); |
| 63 SkASSERT(kMaxImageBound.contains(imageSpaceBounds)); | 63 SkASSERT(kMaxImageBound.contains(imageSpaceBounds)); |
| 64 #endif | 64 #endif |
| 65 canvas->save(); | 65 canvas->save(); |
| 66 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); | 66 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); |
| 67 GrTestTarget tt; | 67 GrTestTarget tt; |
| 68 context->getTestTarget(&tt); | 68 context->getTestTarget(&tt); |
| 69 if (NULL == tt.target()) { | 69 if (nullptr == tt.target()) { |
| 70 SkDEBUGFAIL("Couldn't get Gr test target."); | 70 SkDEBUGFAIL("Couldn't get Gr test target."); |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 GrPipelineBuilder pipelineBuilder; | 73 GrPipelineBuilder pipelineBuilder; |
| 74 | 74 |
| 75 SkRRect rrect = fRRects[curRRect]; | 75 SkRRect rrect = fRRects[curRRect]; |
| 76 rrect.offset(SkIntToScalar(x), SkIntToScalar(y)); | 76 rrect.offset(SkIntToScalar(x), SkIntToScalar(y)); |
| 77 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectEffect::Create(e
dgeType, rrect)); | 77 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectEffect::Create(e
dgeType, rrect)); |
| 78 SkASSERT(fp); | 78 SkASSERT(fp); |
| 79 if (fp) { | 79 if (fp) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 SkTDArray<SkRRect> fRRects; | 123 SkTDArray<SkRRect> fRRects; |
| 124 typedef GM INHERITED; | 124 typedef GM INHERITED; |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 /////////////////////////////////////////////////////////////////////////////// | 127 /////////////////////////////////////////////////////////////////////////////// |
| 128 | 128 |
| 129 DEF_GM( return new BigRRectAAEffectGM (); ) | 129 DEF_GM( return new BigRRectAAEffectGM (); ) |
| 130 | 130 |
| 131 } | 131 } |
| 132 #endif | 132 #endif |
| OLD | NEW |