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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 switch (fBBoxHierarchyType) { | 824 switch (fBBoxHierarchyType) { |
825 case kNone_BBoxHierarchyType: | 825 case kNone_BBoxHierarchyType: |
826 return NULL; | 826 return NULL; |
827 case kRTree_BBoxHierarchyType: | 827 case kRTree_BBoxHierarchyType: |
828 return SkNEW(SkRTreeFactory); | 828 return SkNEW(SkRTreeFactory); |
829 } | 829 } |
830 SkASSERT(0); // invalid bbhType | 830 SkASSERT(0); // invalid bbhType |
831 return NULL; | 831 return NULL; |
832 } | 832 } |
833 | 833 |
834 /////////////////////////////////////////////////////////////////////////////// | |
835 | |
836 class GatherRenderer : public PictureRenderer { | |
837 public: | |
838 #if SK_SUPPORT_GPU | |
839 GatherRenderer(const GrContext::Options& opts) : INHERITED(opts) { } | |
840 #endif | |
841 | |
842 bool render(SkBitmap** out = NULL) SK_OVERRIDE { | |
843 SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture->cullRect().width(
)), | |
844 SkIntToScalar(fPicture->cullRect().height
())); | |
845 SkData* data = SkPictureUtils::GatherPixelRefs(fPicture, bounds); | |
846 SkSafeUnref(data); | |
847 | |
848 return (fWritePath.isEmpty()); // we don't have anything to write | |
849 } | |
850 | |
851 private: | |
852 SkString getConfigNameInternal() SK_OVERRIDE { | |
853 return SkString("gather_pixelrefs"); | |
854 } | |
855 | |
856 typedef PictureRenderer INHERITED; | |
857 }; | |
858 | |
859 #if SK_SUPPORT_GPU | |
860 PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts) { | |
861 return SkNEW_ARGS(GatherRenderer, (opts)); | |
862 } | |
863 #else | |
864 PictureRenderer* CreateGatherPixelRefsRenderer() { | |
865 return SkNEW(GatherRenderer); | |
866 } | |
867 #endif | |
868 | |
869 } // namespace sk_tools | 834 } // namespace sk_tools |
OLD | NEW |