| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkTwoPointConicalGradient.h" | 8 #include "SkTwoPointConicalGradient.h" |
| 9 #include "SkTwoPointConicalGradient_gpu.h" | 9 #include "SkTwoPointConicalGradient_gpu.h" |
| 10 | 10 |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 info->fRadius[0] = fRadius1; | 298 info->fRadius[0] = fRadius1; |
| 299 info->fRadius[1] = fRadius2; | 299 info->fRadius[1] = fRadius2; |
| 300 if (fFlippedGrad) { | 300 if (fFlippedGrad) { |
| 301 SkTSwap(info->fPoint[0], info->fPoint[1]); | 301 SkTSwap(info->fPoint[0], info->fPoint[1]); |
| 302 SkTSwap(info->fRadius[0], info->fRadius[1]); | 302 SkTSwap(info->fRadius[0], info->fRadius[1]); |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 return kConical_GradientType; | 305 return kConical_GradientType; |
| 306 } | 306 } |
| 307 | 307 |
| 308 SkFlattenable* SkTwoPointConicalGradient::CreateProc(SkReadBuffer& buffer) { | 308 sk_sp<SkFlattenable> SkTwoPointConicalGradient::CreateProc(SkReadBuffer& buffer)
{ |
| 309 DescriptorScope desc; | 309 DescriptorScope desc; |
| 310 if (!desc.unflatten(buffer)) { | 310 if (!desc.unflatten(buffer)) { |
| 311 return nullptr; | 311 return nullptr; |
| 312 } | 312 } |
| 313 SkPoint c1 = buffer.readPoint(); | 313 SkPoint c1 = buffer.readPoint(); |
| 314 SkPoint c2 = buffer.readPoint(); | 314 SkPoint c2 = buffer.readPoint(); |
| 315 SkScalar r1 = buffer.readScalar(); | 315 SkScalar r1 = buffer.readScalar(); |
| 316 SkScalar r2 = buffer.readScalar(); | 316 SkScalar r2 = buffer.readScalar(); |
| 317 | 317 |
| 318 if (buffer.readBool()) { // flipped | 318 if (buffer.readBool()) { // flipped |
| (...skipping 14 matching lines...) Expand all Loading... |
| 333 } | 333 } |
| 334 if (pos) { | 334 if (pos) { |
| 335 if (desc.fCount & 1) { | 335 if (desc.fCount & 1) { |
| 336 pos[half] = SK_Scalar1 - pos[half]; | 336 pos[half] = SK_Scalar1 - pos[half]; |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 } | 339 } |
| 340 | 340 |
| 341 return SkGradientShader::MakeTwoPointConical(c1, r1, c2, r2, desc.fColors, d
esc.fPos, | 341 return SkGradientShader::MakeTwoPointConical(c1, r1, c2, r2, desc.fColors, d
esc.fPos, |
| 342 desc.fCount, desc.fTileMode, de
sc.fGradFlags, | 342 desc.fCount, desc.fTileMode, de
sc.fGradFlags, |
| 343 desc.fLocalMatrix).release(); | 343 desc.fLocalMatrix); |
| 344 } | 344 } |
| 345 | 345 |
| 346 void SkTwoPointConicalGradient::flatten(SkWriteBuffer& buffer) const { | 346 void SkTwoPointConicalGradient::flatten(SkWriteBuffer& buffer) const { |
| 347 this->INHERITED::flatten(buffer); | 347 this->INHERITED::flatten(buffer); |
| 348 buffer.writePoint(fCenter1); | 348 buffer.writePoint(fCenter1); |
| 349 buffer.writePoint(fCenter2); | 349 buffer.writePoint(fCenter2); |
| 350 buffer.writeScalar(fRadius1); | 350 buffer.writeScalar(fRadius1); |
| 351 buffer.writeScalar(fRadius2); | 351 buffer.writeScalar(fRadius2); |
| 352 buffer.writeBool(fFlippedGrad); | 352 buffer.writeBool(fFlippedGrad); |
| 353 } | 353 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 str->appendScalar(fCenter2.fY); | 388 str->appendScalar(fCenter2.fY); |
| 389 str->append(") radius2: "); | 389 str->append(") radius2: "); |
| 390 str->appendScalar(fRadius2); | 390 str->appendScalar(fRadius2); |
| 391 str->append(" "); | 391 str->append(" "); |
| 392 | 392 |
| 393 this->INHERITED::toString(str); | 393 this->INHERITED::toString(str); |
| 394 | 394 |
| 395 str->append(")"); | 395 str->append(")"); |
| 396 } | 396 } |
| 397 #endif | 397 #endif |
| OLD | NEW |