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

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

Issue 942153002: PDF: remove unnecessary mutexes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « src/pdf/SkPDFGraphicState.h ('k') | src/pdf/SkPDFStream.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkPDFShader.h" 10 #include "SkPDFShader.h"
11 11
12 #include "SkData.h" 12 #include "SkData.h"
13 #include "SkPDFCanon.h" 13 #include "SkPDFCanon.h"
14 #include "SkPDFCatalog.h" 14 #include "SkPDFCatalog.h"
15 #include "SkPDFDevice.h" 15 #include "SkPDFDevice.h"
16 #include "SkPDFFormXObject.h" 16 #include "SkPDFFormXObject.h"
17 #include "SkPDFGraphicState.h" 17 #include "SkPDFGraphicState.h"
18 #include "SkPDFResourceDict.h" 18 #include "SkPDFResourceDict.h"
19 #include "SkPDFUtils.h" 19 #include "SkPDFUtils.h"
20 #include "SkScalar.h" 20 #include "SkScalar.h"
21 #include "SkStream.h" 21 #include "SkStream.h"
22 #include "SkTemplates.h" 22 #include "SkTemplates.h"
23 #include "SkThread.h"
24 #include "SkTSet.h" 23 #include "SkTSet.h"
25 #include "SkTypes.h" 24 #include "SkTypes.h"
26 25
27 static bool inverse_transform_bbox(const SkMatrix& matrix, SkRect* bbox) { 26 static bool inverse_transform_bbox(const SkMatrix& matrix, SkRect* bbox) {
28 SkMatrix inverse; 27 SkMatrix inverse;
29 if (!matrix.invert(&inverse)) { 28 if (!matrix.invert(&inverse)) {
30 return false; 29 return false;
31 } 30 }
32 inverse.mapRect(bbox); 31 inverse.mapRect(bbox);
33 return true; 32 return true;
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 } 575 }
577 } 576 }
578 577
579 // static 578 // static
580 SkPDFObject* SkPDFShader::GetPDFShader(SkPDFCanon* canon, 579 SkPDFObject* SkPDFShader::GetPDFShader(SkPDFCanon* canon,
581 SkScalar dpi, 580 SkScalar dpi,
582 const SkShader& shader, 581 const SkShader& shader,
583 const SkMatrix& matrix, 582 const SkMatrix& matrix,
584 const SkIRect& surfaceBBox, 583 const SkIRect& surfaceBBox,
585 SkScalar rasterScale) { 584 SkScalar rasterScale) {
586 // There is only one mutex becasue we don't know which one we'll need.
587 SkAutoTDelete<SkPDFShader::State> state( 585 SkAutoTDelete<SkPDFShader::State> state(
588 SkNEW_ARGS(State, (shader, matrix, surfaceBBox, rasterScale))); 586 SkNEW_ARGS(State, (shader, matrix, surfaceBBox, rasterScale)));
589 return get_pdf_shader_by_state(canon, dpi, &state); 587 return get_pdf_shader_by_state(canon, dpi, &state);
590 } 588 }
591 589
592 static SkPDFResourceDict* get_gradient_resource_dict( 590 static SkPDFResourceDict* get_gradient_resource_dict(
593 SkPDFObject* functionShader, 591 SkPDFObject* functionShader,
594 SkPDFObject* gState) { 592 SkPDFObject* gState) {
595 SkPDFResourceDict* dict = new SkPDFResourceDict(); 593 SkPDFResourceDict* dict = new SkPDFResourceDict();
596 594
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 return false; 1317 return false;
1320 } 1318 }
1321 1319
1322 void SkPDFShader::State::AllocateGradientInfoStorage() { 1320 void SkPDFShader::State::AllocateGradientInfoStorage() {
1323 fColorData.set(sk_malloc_throw( 1321 fColorData.set(sk_malloc_throw(
1324 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); 1322 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar))));
1325 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); 1323 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get());
1326 fInfo.fColorOffsets = 1324 fInfo.fColorOffsets =
1327 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); 1325 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount);
1328 } 1326 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFGraphicState.h ('k') | src/pdf/SkPDFStream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698