gfx/skia/trunk/src/animator/SkDrawShader.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1
michael@0 2 /*
michael@0 3 * Copyright 2006 The Android Open Source Project
michael@0 4 *
michael@0 5 * Use of this source code is governed by a BSD-style license that can be
michael@0 6 * found in the LICENSE file.
michael@0 7 */
michael@0 8
michael@0 9
michael@0 10 #include "SkDrawShader.h"
michael@0 11 #include "SkDrawBitmap.h"
michael@0 12 #include "SkDrawMatrix.h"
michael@0 13 #include "SkDrawPaint.h"
michael@0 14 #include "SkTemplates.h"
michael@0 15
michael@0 16 #if SK_USE_CONDENSED_INFO == 0
michael@0 17
michael@0 18 const SkMemberInfo SkDrawShader::fInfo[] = {
michael@0 19 SK_MEMBER(matrix, Matrix),
michael@0 20 SK_MEMBER(tileMode, TileMode)
michael@0 21 };
michael@0 22
michael@0 23 #endif
michael@0 24
michael@0 25 DEFINE_GET_MEMBER(SkDrawShader);
michael@0 26
michael@0 27 SkDrawShader::SkDrawShader() : matrix(NULL),
michael@0 28 tileMode(SkShader::kClamp_TileMode) {
michael@0 29 }
michael@0 30
michael@0 31 bool SkDrawShader::add() {
michael@0 32 if (fPaint->shader != (SkDrawShader*) -1)
michael@0 33 return true;
michael@0 34 fPaint->shader = this;
michael@0 35 fPaint->fOwnsShader = true;
michael@0 36 return false;
michael@0 37 }
michael@0 38
michael@0 39 void SkDrawShader::addPostlude(SkShader* shader) {
michael@0 40 if (matrix)
michael@0 41 shader->setLocalMatrix(matrix->getMatrix());
michael@0 42 }
michael@0 43
michael@0 44 #if SK_USE_CONDENSED_INFO == 0
michael@0 45
michael@0 46 const SkMemberInfo SkDrawBitmapShader::fInfo[] = {
michael@0 47 SK_MEMBER_INHERITED,
michael@0 48 SK_MEMBER(filterBitmap, Boolean),
michael@0 49 SK_MEMBER(image, BaseBitmap)
michael@0 50 };
michael@0 51
michael@0 52 #endif
michael@0 53
michael@0 54 DEFINE_GET_MEMBER(SkDrawBitmapShader);
michael@0 55
michael@0 56 SkDrawBitmapShader::SkDrawBitmapShader() : filterBitmap(-1), image(NULL) {}
michael@0 57
michael@0 58 bool SkDrawBitmapShader::add() {
michael@0 59 if (fPaint->shader != (SkDrawShader*) -1)
michael@0 60 return true;
michael@0 61 fPaint->shader = this;
michael@0 62 fPaint->fOwnsShader = true;
michael@0 63 return false;
michael@0 64 }
michael@0 65
michael@0 66 SkShader* SkDrawBitmapShader::getShader() {
michael@0 67 if (image == NULL)
michael@0 68 return NULL;
michael@0 69
michael@0 70 // note: bitmap shader now supports independent tile modes for X and Y
michael@0 71 // we pass the same to both, but later we should extend this flexibility
michael@0 72 // to the xml (e.g. tileModeX="repeat" tileModeY="clmap")
michael@0 73 //
michael@0 74 // oops, bitmapshader no longer takes filterBitmap, but deduces it at
michael@0 75 // draw-time from the paint
michael@0 76 SkShader* shader = SkShader::CreateBitmapShader(image->fBitmap,
michael@0 77 (SkShader::TileMode) tileMode,
michael@0 78 (SkShader::TileMode) tileMode);
michael@0 79 SkAutoTDelete<SkShader> autoDel(shader);
michael@0 80 addPostlude(shader);
michael@0 81 (void)autoDel.detach();
michael@0 82 return shader;
michael@0 83 }

mercurial