| 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 #ifndef PictureRenderer_DEFINED |    8 #ifndef PictureRenderer_DEFINED | 
|    9 #define PictureRenderer_DEFINED |    9 #define PictureRenderer_DEFINED | 
|   10  |   10  | 
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  155         fGrContext = fGrContextFactory.get(glContextType); |  155         fGrContext = fGrContextFactory.get(glContextType); | 
|  156         if (NULL == fGrContext) { |  156         if (NULL == fGrContext) { | 
|  157             return false; |  157             return false; | 
|  158         } else { |  158         } else { | 
|  159             fGrContext->ref(); |  159             fGrContext->ref(); | 
|  160             return true; |  160             return true; | 
|  161         } |  161         } | 
|  162 #endif |  162 #endif | 
|  163     } |  163     } | 
|  164  |  164  | 
 |  165 #if SK_SUPPORT_GPU | 
 |  166     void setSampleCount(int sampleCount) { | 
 |  167         fSampleCount = sampleCount; | 
 |  168     } | 
 |  169 #endif | 
 |  170  | 
|  165     void setDrawFilters(DrawFilterFlags const * const filters, const SkString& c
     onfigName) { |  171     void setDrawFilters(DrawFilterFlags const * const filters, const SkString& c
     onfigName) { | 
|  166         memcpy(fDrawFilters, filters, sizeof(fDrawFilters)); |  172         memcpy(fDrawFilters, filters, sizeof(fDrawFilters)); | 
|  167         fDrawFiltersConfig = configName; |  173         fDrawFiltersConfig = configName; | 
|  168     } |  174     } | 
|  169  |  175  | 
|  170     void setBBoxHierarchyType(BBoxHierarchyType bbhType) { |  176     void setBBoxHierarchyType(BBoxHierarchyType bbhType) { | 
|  171         fBBoxHierarchyType = bbhType; |  177         fBBoxHierarchyType = bbhType; | 
|  172     } |  178     } | 
|  173  |  179  | 
|  174     BBoxHierarchyType getBBoxHierarchyType() { return fBBoxHierarchyType; } |  180     BBoxHierarchyType getBBoxHierarchyType() { return fBBoxHierarchyType; } | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|  194             config.appendf("_viewport_%ix%i", fViewport.width(), fViewport.heigh
     t()); |  200             config.appendf("_viewport_%ix%i", fViewport.width(), fViewport.heigh
     t()); | 
|  195         } |  201         } | 
|  196         if (kRTree_BBoxHierarchyType == fBBoxHierarchyType) { |  202         if (kRTree_BBoxHierarchyType == fBBoxHierarchyType) { | 
|  197             config.append("_rtree"); |  203             config.append("_rtree"); | 
|  198         } else if (kTileGrid_BBoxHierarchyType == fBBoxHierarchyType) { |  204         } else if (kTileGrid_BBoxHierarchyType == fBBoxHierarchyType) { | 
|  199             config.append("_grid"); |  205             config.append("_grid"); | 
|  200         } |  206         } | 
|  201 #if SK_SUPPORT_GPU |  207 #if SK_SUPPORT_GPU | 
|  202         switch (fDeviceType) { |  208         switch (fDeviceType) { | 
|  203             case kGPU_DeviceType: |  209             case kGPU_DeviceType: | 
|  204                 config.append("_gpu"); |  210                 if (fSampleCount) { | 
 |  211                     config.appendf("_msaa%d", fSampleCount); | 
 |  212                 } else { | 
 |  213                     config.append("_gpu"); | 
 |  214                 } | 
|  205                 break; |  215                 break; | 
|  206 #if SK_ANGLE |  216 #if SK_ANGLE | 
|  207             case kAngle_DeviceType: |  217             case kAngle_DeviceType: | 
|  208                 config.append("_angle"); |  218                 config.append("_angle"); | 
|  209                 break; |  219                 break; | 
|  210 #endif |  220 #endif | 
|  211             default: |  221             default: | 
|  212                 // Assume that no extra info means bitmap. |  222                 // Assume that no extra info means bitmap. | 
|  213                 break; |  223                 break; | 
|  214         } |  224         } | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  254     } |  264     } | 
|  255 #endif |  265 #endif | 
|  256  |  266  | 
|  257     PictureRenderer() |  267     PictureRenderer() | 
|  258         : fPicture(NULL) |  268         : fPicture(NULL) | 
|  259         , fDeviceType(kBitmap_DeviceType) |  269         , fDeviceType(kBitmap_DeviceType) | 
|  260         , fBBoxHierarchyType(kNone_BBoxHierarchyType) |  270         , fBBoxHierarchyType(kNone_BBoxHierarchyType) | 
|  261         , fScaleFactor(SK_Scalar1) |  271         , fScaleFactor(SK_Scalar1) | 
|  262 #if SK_SUPPORT_GPU |  272 #if SK_SUPPORT_GPU | 
|  263         , fGrContext(NULL) |  273         , fGrContext(NULL) | 
 |  274         , fSampleCount(0) | 
|  264 #endif |  275 #endif | 
|  265         { |  276         { | 
|  266             fGridInfo.fMargin.setEmpty(); |  277             fGridInfo.fMargin.setEmpty(); | 
|  267             fGridInfo.fOffset.setZero(); |  278             fGridInfo.fOffset.setZero(); | 
|  268             fGridInfo.fTileInterval.set(1, 1); |  279             fGridInfo.fTileInterval.set(1, 1); | 
|  269             sk_bzero(fDrawFilters, sizeof(fDrawFilters)); |  280             sk_bzero(fDrawFilters, sizeof(fDrawFilters)); | 
|  270             fViewport.set(0, 0); |  281             fViewport.set(0, 0); | 
|  271         } |  282         } | 
|  272  |  283  | 
|  273 #if SK_SUPPORT_GPU |  284 #if SK_SUPPORT_GPU | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  308     uint32_t recordFlags(); |  319     uint32_t recordFlags(); | 
|  309     SkCanvas* setupCanvas(); |  320     SkCanvas* setupCanvas(); | 
|  310     virtual SkCanvas* setupCanvas(int width, int height); |  321     virtual SkCanvas* setupCanvas(int width, int height); | 
|  311  |  322  | 
|  312 private: |  323 private: | 
|  313     SkISize                fViewport; |  324     SkISize                fViewport; | 
|  314     SkScalar               fScaleFactor; |  325     SkScalar               fScaleFactor; | 
|  315 #if SK_SUPPORT_GPU |  326 #if SK_SUPPORT_GPU | 
|  316     GrContextFactory       fGrContextFactory; |  327     GrContextFactory       fGrContextFactory; | 
|  317     GrContext*             fGrContext; |  328     GrContext*             fGrContext; | 
 |  329     int                    fSampleCount; | 
|  318 #endif |  330 #endif | 
|  319  |  331  | 
|  320     virtual SkString getConfigNameInternal() = 0; |  332     virtual SkString getConfigNameInternal() = 0; | 
|  321  |  333  | 
|  322     typedef SkRefCnt INHERITED; |  334     typedef SkRefCnt INHERITED; | 
|  323 }; |  335 }; | 
|  324  |  336  | 
|  325 /** |  337 /** | 
|  326  * This class does not do any rendering, but its render function executes record
     ing, which we want |  338  * This class does not do any rendering, but its render function executes record
     ing, which we want | 
|  327  * to time. |  339  * to time. | 
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  534  |  546  | 
|  535     typedef PictureRenderer INHERITED; |  547     typedef PictureRenderer INHERITED; | 
|  536 }; |  548 }; | 
|  537  |  549  | 
|  538 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |  550 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 
|  539 extern PictureRenderer* CreatePictureCloneRenderer(); |  551 extern PictureRenderer* CreatePictureCloneRenderer(); | 
|  540  |  552  | 
|  541 } |  553 } | 
|  542  |  554  | 
|  543 #endif  // PictureRenderer_DEFINED |  555 #endif  // PictureRenderer_DEFINED | 
| OLD | NEW |