OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |