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

Side by Side Diff: experimental/PdfViewer/SkPdfRenderer.cpp

Issue 22978012: Split SkDevice into SkBaseDevice and SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Updating to ToT (10994) Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « experimental/PdfViewer/SkNulCanvas.h ('k') | experimental/PdfViewer/SkTrackDevice.h » ('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 2013 Google Inc. 2 * Copyright 2013 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkForceLinking.h" 10 #include "SkForceLinking.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // TODO(edisonn): compare with old bitmap, and save only new bits are availa ble, and save 345 // TODO(edisonn): compare with old bitmap, and save only new bits are availa ble, and save
346 // the numbar and name of last operation, so the file name will reflect op t hat changed. 346 // the numbar and name of last operation, so the file name will reflect op t hat changed.
347 if (gLastKeyword[0] && hasVisualEffect(gLastKeyword)) { // TODO(edisonn): a nd has dirty bits. 347 if (gLastKeyword[0] && hasVisualEffect(gLastKeyword)) { // TODO(edisonn): a nd has dirty bits.
348 gDumpCanvas->flush(); 348 gDumpCanvas->flush();
349 349
350 SkBitmap bitmap; 350 SkBitmap bitmap;
351 setup_bitmap(&bitmap, gDumpBitmap->width(), gDumpBitmap->height()); 351 setup_bitmap(&bitmap, gDumpBitmap->width(), gDumpBitmap->height());
352 352
353 memcpy(bitmap.getPixels(), gDumpBitmap->getPixels(), gDumpBitmap->getSiz e()); 353 memcpy(bitmap.getPixels(), gDumpBitmap->getPixels(), gDumpBitmap->getSiz e());
354 354
355 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (bitmap))); 355 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap)));
356 SkCanvas canvas(device); 356 SkCanvas canvas(device);
357 357
358 // draw context stuff here 358 // draw context stuff here
359 SkPaint blueBorder; 359 SkPaint blueBorder;
360 blueBorder.setColor(SK_ColorBLUE); 360 blueBorder.setColor(SK_ColorBLUE);
361 blueBorder.setStyle(SkPaint::kStroke_Style); 361 blueBorder.setStyle(SkPaint::kStroke_Style);
362 blueBorder.setTextSize(SkDoubleToScalar(20)); 362 blueBorder.setTextSize(SkDoubleToScalar(20));
363 363
364 SkString str; 364 SkString str;
365 365
(...skipping 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after
2902 2902
2903 SkRect rect = renderer.MediaBox(page < 0 ? 0 :page); 2903 SkRect rect = renderer.MediaBox(page < 0 ? 0 :page);
2904 2904
2905 SkScalar width = SkScalarMul(rect.width(), SkDoubleToScalar(sqrt(dpi / 72.0 ))); 2905 SkScalar width = SkScalarMul(rect.width(), SkDoubleToScalar(sqrt(dpi / 72.0 )));
2906 SkScalar height = SkScalarMul(rect.height(), SkDoubleToScalar(sqrt(dpi / 72 .0))); 2906 SkScalar height = SkScalarMul(rect.height(), SkDoubleToScalar(sqrt(dpi / 72 .0)));
2907 2907
2908 rect = SkRect::MakeWH(width, height); 2908 rect = SkRect::MakeWH(width, height);
2909 2909
2910 setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(hei ght)); 2910 setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(hei ght));
2911 2911
2912 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*output))); 2912 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output)));
2913 SkCanvas canvas(device); 2913 SkCanvas canvas(device);
2914 2914
2915 return renderer.renderPage(page, &canvas, rect); 2915 return renderer.renderPage(page, &canvas, rect);
2916 } 2916 }
OLDNEW
« no previous file with comments | « experimental/PdfViewer/SkNulCanvas.h ('k') | experimental/PdfViewer/SkTrackDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698