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

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

Issue 1046293002: SkPDF: SkPDFGraphicState Lookup hashtabled (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-04-01 (Wednesday) 16:16:21 EDT Created 5 years, 8 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/SkPDFDevice.h ('k') | src/pdf/SkPDFGraphicState.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 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 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 void SkPDFDevice::drawFormXObjectWithMask(int xObjectIndex, 1562 void SkPDFDevice::drawFormXObjectWithMask(int xObjectIndex,
1563 SkPDFFormXObject* mask, 1563 SkPDFFormXObject* mask,
1564 const SkClipStack* clipStack, 1564 const SkClipStack* clipStack,
1565 const SkRegion& clipRegion, 1565 const SkRegion& clipRegion,
1566 SkXfermode::Mode mode, 1566 SkXfermode::Mode mode,
1567 bool invertClip) { 1567 bool invertClip) {
1568 if (clipRegion.isEmpty() && !invertClip) { 1568 if (clipRegion.isEmpty() && !invertClip) {
1569 return; 1569 return;
1570 } 1570 }
1571 1571
1572 SkAutoTUnref<SkPDFGraphicState> sMaskGS( 1572 SkAutoTUnref<SkPDFObject> sMaskGS(SkPDFGraphicState::GetSMaskGraphicState(
1573 SkPDFGraphicState::GetSMaskGraphicState(
1574 mask, invertClip, SkPDFGraphicState::kAlpha_SMaskMode)); 1573 mask, invertClip, SkPDFGraphicState::kAlpha_SMaskMode));
1575 1574
1576 SkMatrix identity; 1575 SkMatrix identity;
1577 identity.reset(); 1576 identity.reset();
1578 SkPaint paint; 1577 SkPaint paint;
1579 paint.setXfermodeMode(mode); 1578 paint.setXfermodeMode(mode);
1580 ScopedContentEntry content(this, clipStack, clipRegion, identity, paint); 1579 ScopedContentEntry content(this, clipStack, clipRegion, identity, paint);
1581 if (!content.entry()) { 1580 if (!content.entry()) {
1582 return; 1581 return;
1583 } 1582 }
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 entry->fGraphicStateIndex = resourceIndex; 1933 entry->fGraphicStateIndex = resourceIndex;
1935 1934
1936 if (hasText) { 1935 if (hasText) {
1937 entry->fTextScaleX = paint.getTextScaleX(); 1936 entry->fTextScaleX = paint.getTextScaleX();
1938 entry->fTextFill = paint.getStyle(); 1937 entry->fTextFill = paint.getStyle();
1939 } else { 1938 } else {
1940 entry->fTextScaleX = 0; 1939 entry->fTextScaleX = 0;
1941 } 1940 }
1942 } 1941 }
1943 1942
1944 int SkPDFDevice::addGraphicStateResource(SkPDFGraphicState* gs) { 1943 int SkPDFDevice::addGraphicStateResource(SkPDFObject* gs) {
1945 // Assumes that gs has been canonicalized (so we can directly compare 1944 // Assumes that gs has been canonicalized (so we can directly compare
1946 // pointers). 1945 // pointers).
1947 int result = fGraphicStateResources.find(gs); 1946 int result = fGraphicStateResources.find(gs);
1948 if (result < 0) { 1947 if (result < 0) {
1949 result = fGraphicStateResources.count(); 1948 result = fGraphicStateResources.count();
1950 fGraphicStateResources.push(gs); 1949 fGraphicStateResources.push(gs);
1951 gs->ref(); 1950 gs->ref();
1952 } 1951 }
1953 return result; 1952 return result;
1954 } 1953 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 return; 2132 return;
2134 } 2133 }
2135 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap)); 2134 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap));
2136 if (!image) { 2135 if (!image) {
2137 return; 2136 return;
2138 } 2137 }
2139 2138
2140 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), 2139 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()),
2141 &content.entry()->fContent); 2140 &content.entry()->fContent);
2142 } 2141 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDevice.h ('k') | src/pdf/SkPDFGraphicState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698