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

Side by Side Diff: core/fxge/skia/fx_skia_device.cpp

Issue 2334323005: Rename dictionary set and get methods (Closed)
Patch Set: Created 4 years, 3 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 | « core/fxge/dib/fx_dib_engine_unittest.cpp ('k') | fpdfsdk/cba_annotiterator.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 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if defined(_SKIA_SUPPORT_) 5 #if defined(_SKIA_SUPPORT_)
6 #include <algorithm> 6 #include <algorithm>
7 #include <vector> 7 #include <vector>
8 8
9 #include "core/fxcodec/include/fx_codec.h" 9 #include "core/fxcodec/include/fx_codec.h"
10 #include "core/fxcrt/include/fx_memory.h" 10 #include "core/fxcrt/include/fx_memory.h"
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 kRadialShading != pPattern->GetShadingType()) { 1224 kRadialShading != pPattern->GetShadingType()) {
1225 // TODO(caryclark) more types 1225 // TODO(caryclark) more types
1226 return false; 1226 return false;
1227 } 1227 }
1228 const std::vector<std::unique_ptr<CPDF_Function>>& pFuncs = 1228 const std::vector<std::unique_ptr<CPDF_Function>>& pFuncs =
1229 pPattern->GetFuncs(); 1229 pPattern->GetFuncs();
1230 int nFuncs = pFuncs.size(); 1230 int nFuncs = pFuncs.size();
1231 if (nFuncs != 1) // TODO(caryclark) remove this restriction 1231 if (nFuncs != 1) // TODO(caryclark) remove this restriction
1232 return false; 1232 return false;
1233 CPDF_Dictionary* pDict = pPattern->GetShadingObject()->GetDict(); 1233 CPDF_Dictionary* pDict = pPattern->GetShadingObject()->GetDict();
1234 CPDF_Array* pCoords = pDict->GetArrayBy("Coords"); 1234 CPDF_Array* pCoords = pDict->GetArrayFor("Coords");
1235 if (!pCoords) 1235 if (!pCoords)
1236 return true; 1236 return true;
1237 // TODO(caryclark) Respect Domain[0], Domain[1]. (Don't know what they do 1237 // TODO(caryclark) Respect Domain[0], Domain[1]. (Don't know what they do
1238 // yet.) 1238 // yet.)
1239 SkTDArray<SkColor> skColors; 1239 SkTDArray<SkColor> skColors;
1240 SkTDArray<SkScalar> skPos; 1240 SkTDArray<SkScalar> skPos;
1241 for (int j = 0; j < nFuncs; j++) { 1241 for (int j = 0; j < nFuncs; j++) {
1242 if (!pFuncs[j]) 1242 if (!pFuncs[j])
1243 continue; 1243 continue;
1244 1244
1245 if (const CPDF_SampledFunc* pSampledFunc = pFuncs[j]->ToSampledFunc()) { 1245 if (const CPDF_SampledFunc* pSampledFunc = pFuncs[j]->ToSampledFunc()) {
1246 /* TODO(caryclark) 1246 /* TODO(caryclark)
1247 Type 0 Sampled Functions in PostScript can also have an Order integer 1247 Type 0 Sampled Functions in PostScript can also have an Order integer
1248 in the dictionary. PDFium doesn't appear to check for this anywhere. 1248 in the dictionary. PDFium doesn't appear to check for this anywhere.
1249 */ 1249 */
1250 if (!AddSamples(pSampledFunc, &skColors, &skPos)) 1250 if (!AddSamples(pSampledFunc, &skColors, &skPos))
1251 return false; 1251 return false;
1252 } else if (const CPDF_ExpIntFunc* pExpIntFuc = pFuncs[j]->ToExpIntFunc()) { 1252 } else if (const CPDF_ExpIntFunc* pExpIntFuc = pFuncs[j]->ToExpIntFunc()) {
1253 if (!AddColors(pExpIntFuc, &skColors)) 1253 if (!AddColors(pExpIntFuc, &skColors))
1254 return false; 1254 return false;
1255 skPos.push(0); 1255 skPos.push(0);
1256 skPos.push(1); 1256 skPos.push(1);
1257 } else if (const CPDF_StitchFunc* pStitchFunc = pFuncs[j]->ToStitchFunc()) { 1257 } else if (const CPDF_StitchFunc* pStitchFunc = pFuncs[j]->ToStitchFunc()) {
1258 if (!AddStitching(pStitchFunc, &skColors, &skPos)) 1258 if (!AddStitching(pStitchFunc, &skColors, &skPos))
1259 return false; 1259 return false;
1260 } else { 1260 } else {
1261 return false; 1261 return false;
1262 } 1262 }
1263 } 1263 }
1264 CPDF_Array* pArray = pDict->GetArrayBy("Extend"); 1264 CPDF_Array* pArray = pDict->GetArrayFor("Extend");
1265 bool clipStart = !pArray || !pArray->GetIntegerAt(0); 1265 bool clipStart = !pArray || !pArray->GetIntegerAt(0);
1266 bool clipEnd = !pArray || !pArray->GetIntegerAt(1); 1266 bool clipEnd = !pArray || !pArray->GetIntegerAt(1);
1267 SkPaint paint; 1267 SkPaint paint;
1268 paint.setAntiAlias(true); 1268 paint.setAntiAlias(true);
1269 paint.setAlpha(alpha); 1269 paint.setAlpha(alpha);
1270 SkMatrix skMatrix = ToSkMatrix(*pMatrix); 1270 SkMatrix skMatrix = ToSkMatrix(*pMatrix);
1271 SkRect skRect = SkRect::MakeLTRB(clip_rect.left, clip_rect.top, 1271 SkRect skRect = SkRect::MakeLTRB(clip_rect.left, clip_rect.top,
1272 clip_rect.right, clip_rect.bottom); 1272 clip_rect.right, clip_rect.bottom);
1273 SkPath skClip; 1273 SkPath skClip;
1274 SkPath skPath; 1274 SkPath skPath;
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 SkA32Assert(a); 1683 SkA32Assert(a);
1684 SkASSERT(r <= a); 1684 SkASSERT(r <= a);
1685 SkASSERT(g <= a); 1685 SkASSERT(g <= a);
1686 SkASSERT(b <= a); 1686 SkASSERT(b <= a);
1687 } 1687 }
1688 } 1688 }
1689 #endif 1689 #endif
1690 } 1690 }
1691 1691
1692 #endif 1692 #endif
OLDNEW
« no previous file with comments | « core/fxge/dib/fx_dib_engine_unittest.cpp ('k') | fpdfsdk/cba_annotiterator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698