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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 1011403004: BitmapTextBatch and BitmapTextBlob (Closed) Base URL: https://skia.googlesource.com/skia.git@dfpr_take_2
Patch Set: fix for segfault Created 5 years, 8 months 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 | « no previous file | gyp/gpu.gypi » ('j') | 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 2015 Google Inc. 2 * Copyright 2015 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 "DMSrcSink.h" 8 #include "DMSrcSink.h"
9 #include "SamplePipeControllers.h" 9 #include "SamplePipeControllers.h"
10 #include "SkCommonFlags.h" 10 #include "SkCommonFlags.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 Error SKPSrc::draw(SkCanvas* canvas) const { 236 Error SKPSrc::draw(SkCanvas* canvas) const {
237 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(fPath.c_str())); 237 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(fPath.c_str()));
238 if (!stream) { 238 if (!stream) {
239 return SkStringPrintf("Couldn't read %s.", fPath.c_str()); 239 return SkStringPrintf("Couldn't read %s.", fPath.c_str());
240 } 240 }
241 SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream, &lazy_decode _bitmap)); 241 SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream, &lazy_decode _bitmap));
242 if (!pic) { 242 if (!pic) {
243 return SkStringPrintf("Couldn't decode %s as a picture.", fPath.c_str()) ; 243 return SkStringPrintf("Couldn't decode %s as a picture.", fPath.c_str()) ;
244 } 244 }
245 stream.reset((SkStream*)NULL); // Might as well drop this when we're done w ith it. 245 stream.reset((SkStream*)NULL); // Might as well drop this when we're done w ith it.
246
246 canvas->clipRect(kSKPViewport); 247 canvas->clipRect(kSKPViewport);
248 // Testing TextBlob batching requires that we see individual text blobs more than once
249 // TODO remove this and add a flag to DM so we can run skps multiple times
250 //#define DOUBLE_LOOP
251 #ifdef DOUBLE_LOOP
252 {
253 SkAutoCanvasRestore acr(canvas, true);
254 #endif
255 canvas->drawPicture(pic);
256 #ifdef DOUBLE_LOOP
257 }
258 canvas->clear(0);
247 canvas->drawPicture(pic); 259 canvas->drawPicture(pic);
260 #endif
248 return ""; 261 return "";
249 } 262 }
250 263
251 SkISize SKPSrc::size() const { 264 SkISize SKPSrc::size() const {
252 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(fPath.c_str())); 265 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(fPath.c_str()));
253 if (!stream) { 266 if (!stream) {
254 return SkISize::Make(0,0); 267 return SkISize::Make(0,0);
255 } 268 }
256 SkPictInfo info; 269 SkPictInfo info;
257 if (!SkPicture::InternalOnly_StreamIsSKP(stream, &info)) { 270 if (!SkPicture::InternalOnly_StreamIsSKP(stream, &info)) {
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 surfaces.unrefAll(); 629 surfaces.unrefAll();
617 return ""; 630 return "";
618 } 631 }
619 SkISize size() const override { return fSize; } 632 SkISize size() const override { return fSize; }
620 Name name() const override { sk_throw(); return ""; } // No one should be calling this. 633 Name name() const override { sk_throw(); return ""; } // No one should be calling this.
621 } proxy(fW, fH, pic, src.size()); 634 } proxy(fW, fH, pic, src.size());
622 return fSink->draw(proxy, bitmap, stream, log); 635 return fSink->draw(proxy, bitmap, stream, log);
623 } 636 }
624 637
625 } // namespace DM 638 } // namespace DM
OLDNEW
« no previous file with comments | « no previous file | gyp/gpu.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698