Chromium Code Reviews| 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 == 4) { |
|
bsalomon
2013/04/29 18:59:26
if (fSampleCount) {
config.appendf("_msaa%d",
jvanverth1
2013/04/29 19:36:27
Done.
| |
| 211 config.append("_msaa4"); | |
| 212 } else if (fSampleCount == 16) { | |
| 213 config.append("_msaa16"); | |
| 214 } else { | |
| 215 config.append("_gpu"); | |
| 216 } | |
| 205 break; | 217 break; |
| 206 #if SK_ANGLE | 218 #if SK_ANGLE |
| 207 case kAngle_DeviceType: | 219 case kAngle_DeviceType: |
| 208 config.append("_angle"); | 220 config.append("_angle"); |
| 209 break; | 221 break; |
| 210 #endif | 222 #endif |
| 211 default: | 223 default: |
| 212 // Assume that no extra info means bitmap. | 224 // Assume that no extra info means bitmap. |
| 213 break; | 225 break; |
| 214 } | 226 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 } | 266 } |
| 255 #endif | 267 #endif |
| 256 | 268 |
| 257 PictureRenderer() | 269 PictureRenderer() |
| 258 : fPicture(NULL) | 270 : fPicture(NULL) |
| 259 , fDeviceType(kBitmap_DeviceType) | 271 , fDeviceType(kBitmap_DeviceType) |
| 260 , fBBoxHierarchyType(kNone_BBoxHierarchyType) | 272 , fBBoxHierarchyType(kNone_BBoxHierarchyType) |
| 261 , fScaleFactor(SK_Scalar1) | 273 , fScaleFactor(SK_Scalar1) |
| 262 #if SK_SUPPORT_GPU | 274 #if SK_SUPPORT_GPU |
| 263 , fGrContext(NULL) | 275 , fGrContext(NULL) |
| 276 , fSampleCount(0) | |
| 264 #endif | 277 #endif |
| 265 { | 278 { |
| 266 fGridInfo.fMargin.setEmpty(); | 279 fGridInfo.fMargin.setEmpty(); |
| 267 fGridInfo.fOffset.setZero(); | 280 fGridInfo.fOffset.setZero(); |
| 268 fGridInfo.fTileInterval.set(1, 1); | 281 fGridInfo.fTileInterval.set(1, 1); |
| 269 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); | 282 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); |
| 270 fViewport.set(0, 0); | 283 fViewport.set(0, 0); |
| 271 } | 284 } |
| 272 | 285 |
| 273 #if SK_SUPPORT_GPU | 286 #if SK_SUPPORT_GPU |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 uint32_t recordFlags(); | 321 uint32_t recordFlags(); |
| 309 SkCanvas* setupCanvas(); | 322 SkCanvas* setupCanvas(); |
| 310 virtual SkCanvas* setupCanvas(int width, int height); | 323 virtual SkCanvas* setupCanvas(int width, int height); |
| 311 | 324 |
| 312 private: | 325 private: |
| 313 SkISize fViewport; | 326 SkISize fViewport; |
| 314 SkScalar fScaleFactor; | 327 SkScalar fScaleFactor; |
| 315 #if SK_SUPPORT_GPU | 328 #if SK_SUPPORT_GPU |
| 316 GrContextFactory fGrContextFactory; | 329 GrContextFactory fGrContextFactory; |
| 317 GrContext* fGrContext; | 330 GrContext* fGrContext; |
| 331 int fSampleCount; | |
|
scroggo
2013/04/29 19:05:44
Should this be an enum that only accepts 4, 16, an
jvanverth1
2013/04/29 19:36:27
Done.
| |
| 318 #endif | 332 #endif |
| 319 | 333 |
| 320 virtual SkString getConfigNameInternal() = 0; | 334 virtual SkString getConfigNameInternal() = 0; |
| 321 | 335 |
| 322 typedef SkRefCnt INHERITED; | 336 typedef SkRefCnt INHERITED; |
| 323 }; | 337 }; |
| 324 | 338 |
| 325 /** | 339 /** |
| 326 * This class does not do any rendering, but its render function executes record ing, which we want | 340 * This class does not do any rendering, but its render function executes record ing, which we want |
| 327 * to time. | 341 * to time. |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 534 | 548 |
| 535 typedef PictureRenderer INHERITED; | 549 typedef PictureRenderer INHERITED; |
| 536 }; | 550 }; |
| 537 | 551 |
| 538 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 552 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
| 539 extern PictureRenderer* CreatePictureCloneRenderer(); | 553 extern PictureRenderer* CreatePictureCloneRenderer(); |
| 540 | 554 |
| 541 } | 555 } |
| 542 | 556 |
| 543 #endif // PictureRenderer_DEFINED | 557 #endif // PictureRenderer_DEFINED |
| OLD | NEW |