'../src/ports/SkTime_Unix.cpp',
'../src/ports/SkTLS_pthread.cpp',
],
- 'conditions': [
+ 'conditions': [
# when we build for win, we only want one of these default files
[ 'skia_directwrite', {
'sources!': [
enum DrawBitmapRectFlags {
kNone_DrawBitmapRectflag = 0x0,
- /**
+ /**
* When filtering is enabled, allow the color samples outside of
- * the src rect (but still in the src bitmap) to bleed into the
+ * the src rect (but still in the src bitmap) to bleed into the
* drawn portion
*/
kBleed_DrawBitmapRectFlag = 0x1,
GrPathRendererChain::DrawType drawType = GrPathRendererChain::kColor_DrawType,
GrPathRendererChain::StencilSupport* stencilSupport = NULL);
-
+
#if GR_CACHE_STATS
void printCacheStats() const;
#endif
void SkDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
const SkRect* src, const SkRect& dst,
- const SkPaint& paint,
+ const SkPaint& paint,
SkCanvas::DrawBitmapRectFlags flags) {
SkMatrix matrix;
SkRect bitmapBounds, tmpSrc, tmpDst;
#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V13_AND_ALL_OTHER_INSTANCES_TOO
&& PRIOR_PICTURE_VERSION != info.fVersion // TODO: remove when .skps regenerated
#endif
- ) {
+ ) {
return false;
}
SkCanvas::DrawBitmapRectFlags flags;
#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V13_AND_ALL_OTHER_INSTANCES_TOO
flags = SkCanvas::kNone_DrawBitmapRectflag;
- // TODO: remove this backwards compatibility code once the .skps are
+ // TODO: remove this backwards compatibility code once the .skps are
// regenerated
SkASSERT(32 == size || 48 == size || // old sizes
36 == size || 52 == size); // new sizes
virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top,
const SkPaint*) SK_OVERRIDE;
virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
+ const SkRect& dst, const SkPaint* paint,
DrawBitmapRectFlags flags) SK_OVERRIDE;
virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&,
const SkPaint*) SK_OVERRIDE;
data[0 + baseIdx] = baseVert + 0; // p0
data[1 + baseIdx] = baseVert + 1; // p1
data[2 + baseIdx] = baseVert + 2; // p2
-
+
data[3 + baseIdx] = baseVert + 2; // p2
data[4 + baseIdx] = baseVert + 1; // p1
data[5 + baseIdx] = baseVert + 3; // p3
-
+
data[6 + baseIdx] = baseVert + 0; // p0
data[7 + baseIdx] = baseVert + 5; // p5
data[8 + baseIdx] = baseVert + 1; // p1
-
+
data[9 + baseIdx] = baseVert + 0; // p0
data[10+ baseIdx] = baseVert + 4; // p4
data[11+ baseIdx] = baseVert + 5; // p5
GrPoint fPos;
GrColor fCoverage;
};
-
+
struct BezierVertex {
GrPoint fPos;
union {
GrDrawTarget::AutoReleaseGeometry* arg,
SkRect* devBounds) {
GrDrawState* drawState = target->drawState();
-
+
const SkMatrix& viewM = drawState->getViewMatrix();
-
+
// All the vertices that we compute are within 1 of path control points with the exception of
// one of the bounding vertices for each quad. The add_quads() function will update the bounds
// for each quad added.
*devBounds = path.getBounds();
viewM.mapRect(devBounds);
devBounds->outset(SK_Scalar1, SK_Scalar1);
-
+
int vertCnt = kVertsPerQuad * quadCnt + kVertsPerQuad * conicCnt;
-
+
target->drawState()->setVertexAttribs<gHairlineBezierAttribs>(SK_ARRAY_COUNT(gHairlineBezierAttribs));
SkASSERT(sizeof(BezierVertex) == target->getDrawState().getVertexSize());
-
+
if (!arg->set(target, vertCnt, 0)) {
return false;
}
-
+
BezierVertex* verts = reinterpret_cast<BezierVertex*>(arg->vertices());
-
+
const SkMatrix* toDevice = NULL;
const SkMatrix* toSrc = NULL;
SkMatrix ivm;
-
+
if (viewM.hasPerspective()) {
if (viewM.invert(&ivm)) {
toDevice = &viewM;
toSrc = &ivm;
}
}
-
+
int unsubdivQuadCnt = quads.count() / 3;
for (int i = 0; i < unsubdivQuadCnt; ++i) {
SkASSERT(qSubdivs[i] >= 0);
add_quads(&quads[3*i], qSubdivs[i], toDevice, toSrc, &verts, devBounds);
}
-
+
// Start Conics
for (int i = 0; i < conicCnt; ++i) {
add_conics(&conics[3*i], cWeights[i], toDevice, toSrc, &verts, devBounds);
SkRect tolDevBounds = devBounds;
tolDevBounds.outset(SK_Scalar1 / 10000, SK_Scalar1 / 10000);
SkRect actualBounds;
-
+
VertexType* verts = reinterpret_cast<VertexType*>(vertices);
bool first = true;
for (int i = 0; i < vCount; ++i) {
if (!first) {
return tolDevBounds.contains(actualBounds);
}
-
+
return true;
}
const SkStrokeRec&,
GrDrawTarget* target,
bool antiAlias) {
-
+
GrDrawState* drawState = target->drawState();
-
+
SkIRect devClipBounds;
target->getClip()->getConservativeBounds(drawState->getRenderTarget(), &devClipBounds);
-
+
int lineCnt;
int quadCnt;
int conicCnt;
&lines, &quads, &conics, &qSubdivs, &cWeights);
lineCnt = lines.count() / 2;
conicCnt = conics.count() / 3;
-
+
// do lines first
{
GrDrawTarget::AutoReleaseGeometry arg;
}
}
}
-
+
// then quadratics/conics
{
GrDrawTarget::AutoReleaseGeometry arg;
SkRect devBounds;
-
+
if (!this->createBezierGeom(path,
target,
quads,
&devBounds)) {
return false;
}
-
+
GrDrawTarget::AutoStateRestore asr;
-
+
// createGeom transforms the geometry to device space when the matrix does not have
// perspective.
if (target->getDrawState().getViewMatrix().hasPerspective()) {
GrDrawState* drawState = target->drawState();
static const int kEdgeAttrIndex = 1;
-
+
GrEffectRef* hairQuadEffect = HairQuadEdgeEffect::Create();
GrEffectRef* hairConicEffect = HairConicEdgeEffect::Create();
-
+
// Check devBounds
SkASSERT(check_bounds<BezierVertex>(drawState, devBounds, arg.vertices(),
kVertsPerQuad * quadCnt + kVertsPerQuad * conicCnt));
-
+
{
GrDrawState::AutoRestoreEffects are(drawState);
target->setIndexSourceToBuffer(fQuadsIndexBuffer);
quads += n;
}
}
-
+
{
GrDrawState::AutoRestoreEffects are(drawState);
int conics = 0;
}
}
}
-
+
target->resetIndexSource();
return true;
const SkStrokeRec& stroke,
const GrDrawTarget* target,
bool antiAlias) const SK_OVERRIDE;
-
+
typedef SkTArray<SkPoint, true> PtArray;
typedef SkTArray<int, true> IntArray;
typedef SkTArray<float, true> FloatArray;
-
+
protected:
virtual bool onDrawPath(const SkPath& path,
const SkStrokeRec& stroke,
int lineCnt,
GrDrawTarget::AutoReleaseGeometry* arg,
SkRect* devBounds);
-
+
bool createBezierGeom(const SkPath& path,
GrDrawTarget* target,
const PtArray& quads,
public:
DrawToken(GrDrawTarget* drawTarget, uint32_t drawID) :
fDrawTarget(drawTarget), fDrawID(drawID) {}
-
+
bool isIssued() { return NULL != fDrawTarget && fDrawTarget->isIssued(fDrawID); }
-
+
private:
GrDrawTarget* fDrawTarget;
uint32_t fDrawID; // this may wrap, but we're doing direct comparison
// so that should be okay
};
-
+
virtual DrawToken getCurrentDrawToken() { return DrawToken(this, 0); }
-
+
protected:
enum GeometrySrcType {
// Check to see if this set of draw commands has been sent out
virtual bool isIssued(uint32_t drawID) { return true; }
-
+
enum {
kPreallocGeoSrcStateStackCnt = 4,
};
SkSTArray<kGeoPoolStatePreAllocCnt, GeometryPoolState> fGeoPoolStateStack;
virtual bool isIssued(uint32_t drawID) { return drawID != fDrawID; }
-
+
bool fFlushing;
uint32_t fDrawID;
// Specific to drawBitmapRect, but needs to be different from HasPaint,
// which is used for all drawBitmap calls, so include it here.
kDrawBitmap_HasSrcRect_DrawOpFlag = 1 << 1,
- // SkCanvas::DrawBitmapRectFlags::kBleed_DrawBitmapRectFlag is
+ // SkCanvas::DrawBitmapRectFlags::kBleed_DrawBitmapRectFlag is
// converted into and out of this flag to save space
kDrawBitmap_Bleed_DrawOpFlag = 1 << 2,
};
const SkRect* dst = skip<SkRect>(reader);
const SkBitmap* bitmap = holder.getBitmap();
if (state->shouldDraw()) {
- canvas->drawBitmapRectToRect(*bitmap, src, *dst,
+ canvas->drawBitmapRectToRect(*bitmap, src, *dst,
hasPaint ? &state->paint() : NULL, dbmrFlags);
}
}
virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top,
const SkPaint*) SK_OVERRIDE;
virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
+ const SkRect& dst, const SkPaint* paint,
DrawBitmapRectFlags flags) SK_OVERRIDE;
virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&,
const SkPaint*) SK_OVERRIDE;
return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeName, localeNameLen));
}
-
}
virtual void drawBitmapRect(const SkDraw&, const SkBitmap& bitmap,
const SkRect* srcOrNull, const SkRect& dst,
- const SkPaint&,
+ const SkPaint&,
SkCanvas::DrawBitmapRectFlags flags) SK_OVERRIDE {
this->addBitmap(bitmap);
}
}
void SkDebugCanvas::drawBitmapRectToRect(const SkBitmap& bitmap,
- const SkRect* src, const SkRect& dst,
+ const SkRect* src, const SkRect& dst,
const SkPaint* paint,
SkCanvas::DrawBitmapRectFlags flags) {
addDrawCommand(new SkDrawBitmapRectCommand(bitmap, src, dst, paint, flags));