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

Side by Side Diff: src/pdf/SkPDFDevice.cpp

Issue 143073008: add installPixels (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 11 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 | « src/lazy/SkDiscardablePixelRef.cpp ('k') | src/utils/SkPDFRasterizer.cpp » ('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 2011 Google Inc. 2 * Copyright 2011 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 "SkPDFDevice.h" 8 #include "SkPDFDevice.h"
9 9
10 #include "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 SkScalar scaleY = physicalPerspectiveOutline.getBounds().height() / 2243 SkScalar scaleY = physicalPerspectiveOutline.getBounds().height() /
2244 bounds.height(); 2244 bounds.height();
2245 2245
2246 // TODO(edisonn): A better approach would be to use a bitmap shader 2246 // TODO(edisonn): A better approach would be to use a bitmap shader
2247 // (in clamp mode) and draw a rect over the entire bounding box. Then 2247 // (in clamp mode) and draw a rect over the entire bounding box. Then
2248 // intersect perspectiveOutline to the clip. That will avoid introducing 2248 // intersect perspectiveOutline to the clip. That will avoid introducing
2249 // alpha to the image while still giving good behavior at the edge of 2249 // alpha to the image while still giving good behavior at the edge of
2250 // the image. Avoiding alpha will reduce the pdf size and generation 2250 // the image. Avoiding alpha will reduce the pdf size and generation
2251 // CPU time some. 2251 // CPU time some.
2252 2252
2253 perspectiveBitmap.setConfig( 2253 const int w = SkScalarCeilToInt(physicalPerspectiveOutline.getBounds().w idth());
2254 SkBitmap::kARGB_8888_Config, 2254 const int h = SkScalarCeilToInt(physicalPerspectiveOutline.getBounds().h eight());
2255 SkScalarCeilToInt( 2255 if (!perspectiveBitmap.allocPixels(SkImageInfo::MakeN32Premul(w, h))) {
2256 physicalPerspectiveOutline.getBounds().width()), 2256 return;
2257 SkScalarCeilToInt( 2257 }
2258 physicalPerspectiveOutline.getBounds().height()));
2259 perspectiveBitmap.allocPixels();
2260 perspectiveBitmap.eraseColor(SK_ColorTRANSPARENT); 2258 perspectiveBitmap.eraseColor(SK_ColorTRANSPARENT);
2261 2259
2262 SkBitmapDevice device(perspectiveBitmap); 2260 SkBitmapDevice device(perspectiveBitmap);
2263 SkCanvas canvas(&device); 2261 SkCanvas canvas(&device);
2264 2262
2265 SkScalar deltaX = bounds.left(); 2263 SkScalar deltaX = bounds.left();
2266 SkScalar deltaY = bounds.top(); 2264 SkScalar deltaY = bounds.top();
2267 2265
2268 SkMatrix offsetMatrix = origMatrix; 2266 SkMatrix offsetMatrix = origMatrix;
2269 offsetMatrix.postTranslate(-deltaX, -deltaY); 2267 offsetMatrix.postTranslate(-deltaX, -deltaY);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 } 2326 }
2329 2327
2330 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, 2328 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y,
2331 SkCanvas::Config8888) { 2329 SkCanvas::Config8888) {
2332 return false; 2330 return false;
2333 } 2331 }
2334 2332
2335 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { 2333 bool SkPDFDevice::allowImageFilter(SkImageFilter*) {
2336 return false; 2334 return false;
2337 } 2335 }
OLDNEW
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.cpp ('k') | src/utils/SkPDFRasterizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698