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

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: update to ToT, re-add SkBaseDevice::config & default parameter Created 7 years, 4 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
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // TODO(edisonn): compare with old bitmap, and save only new bits are availa ble, and save 235 // TODO(edisonn): compare with old bitmap, and save only new bits are availa ble, and save
236 // the numbar and name of last operation, so the file name will reflect op t hat changed. 236 // the numbar and name of last operation, so the file name will reflect op t hat changed.
237 if (gLastKeyword[0] && hasVisualEffect(gLastKeyword)) { // TODO(edisonn): a nd has dirty bits. 237 if (gLastKeyword[0] && hasVisualEffect(gLastKeyword)) { // TODO(edisonn): a nd has dirty bits.
238 gDumpCanvas->flush(); 238 gDumpCanvas->flush();
239 239
240 SkBitmap bitmap; 240 SkBitmap bitmap;
241 setup_bitmap(&bitmap, gDumpBitmap->width(), gDumpBitmap->height()); 241 setup_bitmap(&bitmap, gDumpBitmap->width(), gDumpBitmap->height());
242 242
243 memcpy(bitmap.getPixels(), gDumpBitmap->getPixels(), gDumpBitmap->getSiz e()); 243 memcpy(bitmap.getPixels(), gDumpBitmap->getPixels(), gDumpBitmap->getSiz e());
244 244
245 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (bitmap))); 245 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap)));
246 SkCanvas canvas(device); 246 SkCanvas canvas(device);
247 247
248 // draw context stuff here 248 // draw context stuff here
249 SkPaint blueBorder; 249 SkPaint blueBorder;
250 blueBorder.setColor(SK_ColorBLUE); 250 blueBorder.setColor(SK_ColorBLUE);
251 blueBorder.setStyle(SkPaint::kStroke_Style); 251 blueBorder.setStyle(SkPaint::kStroke_Style);
252 blueBorder.setTextSize(SkDoubleToScalar(20)); 252 blueBorder.setTextSize(SkDoubleToScalar(20));
253 253
254 SkString str; 254 SkString str;
255 255
(...skipping 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after
2634 2634
2635 SkRect rect = renderer.MediaBox(page < 0 ? 0 :page); 2635 SkRect rect = renderer.MediaBox(page < 0 ? 0 :page);
2636 2636
2637 SkScalar width = SkScalarMul(rect.width(), SkDoubleToScalar(sqrt(dpi / 72.0 ))); 2637 SkScalar width = SkScalarMul(rect.width(), SkDoubleToScalar(sqrt(dpi / 72.0 )));
2638 SkScalar height = SkScalarMul(rect.height(), SkDoubleToScalar(sqrt(dpi / 72 .0))); 2638 SkScalar height = SkScalarMul(rect.height(), SkDoubleToScalar(sqrt(dpi / 72 .0)));
2639 2639
2640 rect = SkRect::MakeWH(width, height); 2640 rect = SkRect::MakeWH(width, height);
2641 2641
2642 setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(hei ght)); 2642 setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(hei ght));
2643 2643
2644 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*output))); 2644 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output)));
2645 SkCanvas canvas(device); 2645 SkCanvas canvas(device);
2646 2646
2647 return renderer.renderPage(page, &canvas, rect); 2647 return renderer.renderPage(page, &canvas, rect);
2648 } 2648 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698