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 "PictureRenderer.h" | 8 #include "PictureRenderer.h" |
9 #include "picture_utils.h" | 9 #include "picture_utils.h" |
10 #include "SamplePipeControllers.h" | 10 #include "SamplePipeControllers.h" |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 } | 834 } |
835 | 835 |
836 /////////////////////////////////////////////////////////////////////////////// | 836 /////////////////////////////////////////////////////////////////////////////// |
837 | 837 |
838 class GatherRenderer : public PictureRenderer { | 838 class GatherRenderer : public PictureRenderer { |
839 public: | 839 public: |
840 #if SK_SUPPORT_GPU | 840 #if SK_SUPPORT_GPU |
841 GatherRenderer(const GrContext::Options& opts) : INHERITED(opts) { } | 841 GatherRenderer(const GrContext::Options& opts) : INHERITED(opts) { } |
842 #endif | 842 #endif |
843 | 843 |
844 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE { | 844 bool render(SkBitmap** out = NULL) SK_OVERRIDE { |
845 SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture->cullRect().width(
)), | 845 SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture->cullRect().width(
)), |
846 SkIntToScalar(fPicture->cullRect().height
())); | 846 SkIntToScalar(fPicture->cullRect().height
())); |
847 SkData* data = SkPictureUtils::GatherPixelRefs(fPicture, bounds); | 847 SkData* data = SkPictureUtils::GatherPixelRefs(fPicture, bounds); |
848 SkSafeUnref(data); | 848 SkSafeUnref(data); |
849 | 849 |
850 return (fWritePath.isEmpty()); // we don't have anything to write | 850 return (fWritePath.isEmpty()); // we don't have anything to write |
851 } | 851 } |
852 | 852 |
853 private: | 853 private: |
854 virtual SkString getConfigNameInternal() SK_OVERRIDE { | 854 SkString getConfigNameInternal() SK_OVERRIDE { |
855 return SkString("gather_pixelrefs"); | 855 return SkString("gather_pixelrefs"); |
856 } | 856 } |
857 | 857 |
858 typedef PictureRenderer INHERITED; | 858 typedef PictureRenderer INHERITED; |
859 }; | 859 }; |
860 | 860 |
861 #if SK_SUPPORT_GPU | 861 #if SK_SUPPORT_GPU |
862 PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts) { | 862 PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts) { |
863 return SkNEW_ARGS(GatherRenderer, (opts)); | 863 return SkNEW_ARGS(GatherRenderer, (opts)); |
864 } | 864 } |
865 #else | 865 #else |
866 PictureRenderer* CreateGatherPixelRefsRenderer() { | 866 PictureRenderer* CreateGatherPixelRefsRenderer() { |
867 return SkNEW(GatherRenderer); | 867 return SkNEW(GatherRenderer); |
868 } | 868 } |
869 #endif | 869 #endif |
870 | 870 |
871 } // namespace sk_tools | 871 } // namespace sk_tools |
OLD | NEW |