Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: tools/PictureRenderer.cpp

Issue 718443002: Change where layer hoisting data is gathered (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix no-GPU build Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/PictureTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 /** Converts fPicture to a picture that uses a BBoxHierarchy. 217 /** Converts fPicture to a picture that uses a BBoxHierarchy.
218 * PictureRenderer subclasses that are used to test picture playback 218 * PictureRenderer subclasses that are used to test picture playback
219 * should call this method during init. 219 * should call this method during init.
220 */ 220 */
221 void PictureRenderer::buildBBoxHierarchy() { 221 void PictureRenderer::buildBBoxHierarchy() {
222 SkASSERT(fPicture); 222 SkASSERT(fPicture);
223 if (kNone_BBoxHierarchyType != fBBoxHierarchyType && fPicture) { 223 if (kNone_BBoxHierarchyType != fBBoxHierarchyType && fPicture) {
224 SkAutoTDelete<SkBBHFactory> factory(this->getFactory()); 224 SkAutoTDelete<SkBBHFactory> factory(this->getFactory());
225 SkPictureRecorder recorder; 225 SkPictureRecorder recorder;
226 uint32_t flags = this->recordFlags();
227 if (fUseMultiPictureDraw) {
228 flags |= SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag;
229 }
226 SkCanvas* canvas = recorder.beginRecording(fPicture->cullRect().width(), 230 SkCanvas* canvas = recorder.beginRecording(fPicture->cullRect().width(),
227 fPicture->cullRect().height() , 231 fPicture->cullRect().height() ,
228 factory.get(), 232 factory.get(),
229 this->recordFlags()); 233 flags);
230 fPicture->playback(canvas); 234 fPicture->playback(canvas);
231 fPicture.reset(recorder.endRecording()); 235 fPicture.reset(recorder.endRecording());
232 } 236 }
233 } 237 }
234 238
235 void PictureRenderer::resetState(bool callFinish) { 239 void PictureRenderer::resetState(bool callFinish) {
236 #if SK_SUPPORT_GPU 240 #if SK_SUPPORT_GPU
237 SkGLContext* glContext = this->getGLContext(); 241 SkGLContext* glContext = this->getGLContext();
238 if (NULL == glContext) { 242 if (NULL == glContext) {
239 SkASSERT(kBitmap_DeviceType == fDeviceType); 243 SkASSERT(kBitmap_DeviceType == fDeviceType);
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 // Create a separate SkSurface/SkCanvas for each tile along with a 704 // Create a separate SkSurface/SkCanvas for each tile along with a
701 // translated version of the skp (to mimic Chrome's behavior) and 705 // translated version of the skp (to mimic Chrome's behavior) and
702 // feed all such pairs to the MultiPictureDraw. 706 // feed all such pairs to the MultiPictureDraw.
703 for (int i = 0; i < fTileRects.count(); ++i) { 707 for (int i = 0; i < fTileRects.count(); ++i) {
704 SkImageInfo ii = fCanvas->imageInfo().makeWH(fTileRects[i].width(), 708 SkImageInfo ii = fCanvas->imageInfo().makeWH(fTileRects[i].width(),
705 fTileRects[i].height()) ; 709 fTileRects[i].height()) ;
706 *surfaces.append() = fCanvas->newSurface(ii); 710 *surfaces.append() = fCanvas->newSurface(ii);
707 surfaces[i]->getCanvas()->setMatrix(fCanvas->getTotalMatrix()); 711 surfaces[i]->getCanvas()->setMatrix(fCanvas->getTotalMatrix());
708 712
709 SkPictureRecorder recorder; 713 SkPictureRecorder recorder;
714 SkRTreeFactory bbhFactory;
715
710 SkCanvas* c = recorder.beginRecording(SkIntToScalar(fTileRects[i].wi dth()), 716 SkCanvas* c = recorder.beginRecording(SkIntToScalar(fTileRects[i].wi dth()),
711 SkIntToScalar(fTileRects[i].he ight())); 717 SkIntToScalar(fTileRects[i].he ight()),
718 &bbhFactory,
719 SkPictureRecorder::kComputeSav eLayerInfo_RecordFlag);
712 c->save(); 720 c->save();
713 SkMatrix mat; 721 SkMatrix mat;
714 mat.setTranslate(-SkIntToScalar(fTileRects[i].fLeft), 722 mat.setTranslate(-SkIntToScalar(fTileRects[i].fLeft),
715 -SkIntToScalar(fTileRects[i].fTop)); 723 -SkIntToScalar(fTileRects[i].fTop));
716 c->setMatrix(mat); 724 c->setMatrix(mat);
717 c->drawPicture(fPicture); 725 c->drawPicture(fPicture);
718 c->restore(); 726 c->restore();
719 727
720 SkAutoTUnref<SkPicture> xlatedPicture(recorder.endRecording()); 728 SkAutoTUnref<SkPicture> xlatedPicture(recorder.endRecording());
721 729
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts) { 853 PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts) {
846 return SkNEW_ARGS(GatherRenderer, (opts)); 854 return SkNEW_ARGS(GatherRenderer, (opts));
847 } 855 }
848 #else 856 #else
849 PictureRenderer* CreateGatherPixelRefsRenderer() { 857 PictureRenderer* CreateGatherPixelRefsRenderer() {
850 return SkNEW(GatherRenderer); 858 return SkNEW(GatherRenderer);
851 } 859 }
852 #endif 860 #endif
853 861
854 } // namespace sk_tools 862 } // namespace sk_tools
OLDNEW
« no previous file with comments | « tests/PictureTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698